diff options
Diffstat (limited to 'framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building')
16 files changed, 0 insertions, 1477 deletions
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java deleted file mode 100644 index 3cdae7d0..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java +++ /dev/null @@ -1,277 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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.IOException; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.maven.building.FileSource; -import org.apache.maven.building.Source; -import org.apache.maven.settings.Settings; -import org.apache.maven.settings.TrackableBase; -import org.apache.maven.settings.io.SettingsParseException; -import org.apache.maven.settings.io.SettingsReader; -import org.apache.maven.settings.io.SettingsWriter; -import org.apache.maven.settings.merge.MavenSettingsMerger; -import org.apache.maven.settings.validation.SettingsValidator; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.interpolation.EnvarBasedValueSource; -import org.codehaus.plexus.interpolation.InterpolationException; -import org.codehaus.plexus.interpolation.InterpolationPostProcessor; -import org.codehaus.plexus.interpolation.PropertiesBasedValueSource; -import org.codehaus.plexus.interpolation.RegexBasedInterpolator; - -/** - * Builds the effective settings from a user settings file and/or a global settings file. - * - * @author Benjamin Bentmann - */ -@Component( role = SettingsBuilder.class ) -public class DefaultSettingsBuilder - implements SettingsBuilder -{ - - @Requirement - private SettingsReader settingsReader; - - @Requirement - private SettingsWriter settingsWriter; - - @Requirement - private SettingsValidator settingsValidator; - - private MavenSettingsMerger settingsMerger = new MavenSettingsMerger(); - - public DefaultSettingsBuilder setSettingsReader( SettingsReader settingsReader ) - { - this.settingsReader = settingsReader; - return this; - } - - public DefaultSettingsBuilder setSettingsWriter( SettingsWriter settingsWriter ) - { - this.settingsWriter = settingsWriter; - return this; - } - - public DefaultSettingsBuilder setSettingsValidator( SettingsValidator settingsValidator ) - { - this.settingsValidator = settingsValidator; - return this; - } - - @Override - public SettingsBuildingResult build( SettingsBuildingRequest request ) - throws SettingsBuildingException - { - DefaultSettingsProblemCollector problems = new DefaultSettingsProblemCollector( null ); - - Source globalSettingsSource = - getSettingsSource( request.getGlobalSettingsFile(), request.getGlobalSettingsSource() ); - Settings globalSettings = readSettings( globalSettingsSource, request, problems ); - - Source userSettingsSource = - getSettingsSource( request.getUserSettingsFile(), request.getUserSettingsSource() ); - Settings userSettings = readSettings( userSettingsSource, request, problems ); - - settingsMerger.merge( userSettings, globalSettings, TrackableBase.GLOBAL_LEVEL ); - - problems.setSource( "" ); - - userSettings = interpolate( userSettings, request, problems ); - - // for the special case of a drive-relative Windows path, make sure it's absolute to save plugins from trouble - String localRepository = userSettings.getLocalRepository(); - if ( localRepository != null && localRepository.length() > 0 ) - { - File file = new File( localRepository ); - if ( !file.isAbsolute() && file.getPath().startsWith( File.separator ) ) - { - userSettings.setLocalRepository( file.getAbsolutePath() ); - } - } - - if ( hasErrors( problems.getProblems() ) ) - { - throw new SettingsBuildingException( problems.getProblems() ); - } - - return new DefaultSettingsBuildingResult( userSettings, problems.getProblems() ); - } - - private boolean hasErrors( List<SettingsProblem> problems ) - { - if ( problems != null ) - { - for ( SettingsProblem problem : problems ) - { - if ( SettingsProblem.Severity.ERROR.compareTo( problem.getSeverity() ) >= 0 ) - { - return true; - } - } - } - - return false; - } - - private Source getSettingsSource( File settingsFile, Source settingsSource ) - { - if ( settingsSource != null ) - { - return settingsSource; - } - else if ( settingsFile != null && settingsFile.exists() ) - { - return new FileSource( settingsFile ); - } - return null; - } - - private Settings readSettings( Source settingsSource, SettingsBuildingRequest request, - DefaultSettingsProblemCollector problems ) - { - if ( settingsSource == null ) - { - return new Settings(); - } - - problems.setSource( settingsSource.getLocation() ); - - Settings settings; - - try - { - Map<String, ?> options = Collections.singletonMap( SettingsReader.IS_STRICT, Boolean.TRUE ); - - try - { - settings = settingsReader.read( settingsSource.getInputStream(), options ); - } - catch ( SettingsParseException e ) - { - options = Collections.singletonMap( SettingsReader.IS_STRICT, Boolean.FALSE ); - - settings = settingsReader.read( settingsSource.getInputStream(), options ); - - problems.add( SettingsProblem.Severity.WARNING, e.getMessage(), e.getLineNumber(), e.getColumnNumber(), - e ); - } - } - catch ( SettingsParseException e ) - { - problems.add( SettingsProblem.Severity.FATAL, "Non-parseable settings " + settingsSource.getLocation() - + ": " + e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); - return new Settings(); - } - catch ( IOException e ) - { - problems.add( SettingsProblem.Severity.FATAL, "Non-readable settings " + settingsSource.getLocation() - + ": " + e.getMessage(), -1, -1, e ); - return new Settings(); - } - - settingsValidator.validate( settings, problems ); - - return settings; - } - - private Settings interpolate( Settings settings, SettingsBuildingRequest request, - SettingsProblemCollector problems ) - { - StringWriter writer = new StringWriter( 1024 * 4 ); - - try - { - settingsWriter.write( writer, null, settings ); - } - catch ( IOException e ) - { - throw new IllegalStateException( "Failed to serialize settings to memory", e ); - } - - String serializedSettings = writer.toString(); - - RegexBasedInterpolator interpolator = new RegexBasedInterpolator(); - - interpolator.addValueSource( new PropertiesBasedValueSource( request.getUserProperties() ) ); - - interpolator.addValueSource( new PropertiesBasedValueSource( request.getSystemProperties() ) ); - - try - { - interpolator.addValueSource( new EnvarBasedValueSource() ); - } - catch ( IOException e ) - { - problems.add( SettingsProblem.Severity.WARNING, "Failed to use environment variables for interpolation: " - + e.getMessage(), -1, -1, e ); - } - - interpolator.addPostProcessor( new InterpolationPostProcessor() - { - @Override - public Object execute( String expression, Object value ) - { - if ( value != null ) - { - // we're going to parse this back in as XML so we need to escape XML markup - value = value.toString().replace( "&", "&" ).replace( "<", "<" ).replace( ">", ">" ); - return value; - } - return null; - } - } ); - - try - { - serializedSettings = interpolator.interpolate( serializedSettings, "settings" ); - } - catch ( InterpolationException e ) - { - problems.add( SettingsProblem.Severity.ERROR, "Failed to interpolate settings: " + e.getMessage(), -1, -1, - e ); - - return settings; - } - - Settings result; - try - { - Map<String, ?> options = Collections.singletonMap( SettingsReader.IS_STRICT, Boolean.FALSE ); - result = settingsReader.read( new StringReader( serializedSettings ), options ); - } - catch ( IOException e ) - { - problems.add( SettingsProblem.Severity.ERROR, "Failed to interpolate settings: " + e.getMessage(), -1, -1, - e ); - return settings; - } - - return result; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilderFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilderFactory.java deleted file mode 100644 index e728ec55..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilderFactory.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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.settings.io.DefaultSettingsReader; -import org.apache.maven.settings.io.DefaultSettingsWriter; -import org.apache.maven.settings.io.SettingsReader; -import org.apache.maven.settings.io.SettingsWriter; -import org.apache.maven.settings.validation.DefaultSettingsValidator; -import org.apache.maven.settings.validation.SettingsValidator; - -/** - * A factory to create settings builder instances when no dependency injection is available. <em>Note:</em> This class - * is only meant as a utility for developers that want to employ the settings builder outside of the Maven build system, - * Maven plugins should always acquire settings builder instances via dependency injection. Developers might want to - * subclass this factory to provide custom implementations for some of the components used by the settings builder. - * - * @author Benjamin Bentmann - */ -public class DefaultSettingsBuilderFactory -{ - - protected SettingsReader newSettingsReader() - { - return new DefaultSettingsReader(); - } - - protected SettingsWriter newSettingsWriter() - { - return new DefaultSettingsWriter(); - } - - protected SettingsValidator newSettingsValidator() - { - return new DefaultSettingsValidator(); - } - - /** - * Creates a new settings builder instance. - * - * @return The new settings builder instance, never {@code null}. - */ - public DefaultSettingsBuilder newInstance() - { - DefaultSettingsBuilder builder = new DefaultSettingsBuilder(); - - builder.setSettingsReader( newSettingsReader() ); - builder.setSettingsWriter( newSettingsWriter() ); - builder.setSettingsValidator( newSettingsValidator() ); - - return builder; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingRequest.java deleted file mode 100644 index 5a4824e0..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingRequest.java +++ /dev/null @@ -1,160 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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.Properties; - -/** - * Collects settings that control building of effective settings. - * - * @author Benjamin Bentmann - */ -public class DefaultSettingsBuildingRequest - implements SettingsBuildingRequest -{ - - private File globalSettingsFile; - - private File userSettingsFile; - - private SettingsSource globalSettingsSource; - - private SettingsSource userSettingsSource; - - private Properties systemProperties; - - private Properties userProperties; - - @Override - public File getGlobalSettingsFile() - { - return globalSettingsFile; - } - - @Override - public DefaultSettingsBuildingRequest setGlobalSettingsFile( File globalSettingsFile ) - { - this.globalSettingsFile = globalSettingsFile; - - return this; - } - - @Override - public SettingsSource getGlobalSettingsSource() - { - return globalSettingsSource; - } - - @Override - public DefaultSettingsBuildingRequest setGlobalSettingsSource( SettingsSource globalSettingsSource ) - { - this.globalSettingsSource = globalSettingsSource; - - return this; - } - - @Override - public File getUserSettingsFile() - { - return userSettingsFile; - } - - @Override - public DefaultSettingsBuildingRequest setUserSettingsFile( File userSettingsFile ) - { - this.userSettingsFile = userSettingsFile; - - return this; - } - - @Override - public SettingsSource getUserSettingsSource() - { - return userSettingsSource; - } - - @Override - public DefaultSettingsBuildingRequest setUserSettingsSource( SettingsSource userSettingsSource ) - { - this.userSettingsSource = userSettingsSource; - - return this; - } - - @Override - public Properties getSystemProperties() - { - if ( systemProperties == null ) - { - systemProperties = new Properties(); - } - - return systemProperties; - } - - @Override - public DefaultSettingsBuildingRequest setSystemProperties( Properties systemProperties ) - { - if ( systemProperties != null ) - { - this.systemProperties = new Properties(); - // MNG-5670 guard against ConcurrentModificationException - for ( String key : System.getProperties().stringPropertyNames() ) - { - this.systemProperties.put( key, System.getProperty( key ) ); - } - } - else - { - this.systemProperties = null; - } - - return this; - } - - @Override - public Properties getUserProperties() - { - if ( userProperties == null ) - { - userProperties = new Properties(); - } - - return userProperties; - } - - @Override - public DefaultSettingsBuildingRequest setUserProperties( Properties userProperties ) - { - if ( userProperties != null ) - { - this.userProperties = new Properties(); - this.userProperties.putAll( userProperties ); - } - else - { - this.userProperties = null; - } - - return this; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java deleted file mode 100644 index 5c1392a6..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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.util.ArrayList; -import java.util.List; - -import org.apache.maven.settings.Settings; - -/** - * Collects the output of the settings builder. - * - * @author Benjamin Bentmann - */ -class DefaultSettingsBuildingResult - implements SettingsBuildingResult -{ - - private Settings effectiveSettings; - - private List<SettingsProblem> problems; - - public DefaultSettingsBuildingResult( Settings effectiveSettings, List<SettingsProblem> problems ) - { - this.effectiveSettings = effectiveSettings; - this.problems = ( problems != null ) ? problems : new ArrayList<SettingsProblem>(); - } - - @Override - public Settings getEffectiveSettings() - { - return effectiveSettings; - } - - @Override - public List<SettingsProblem> getProblems() - { - return problems; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblem.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblem.java deleted file mode 100644 index b261fa1d..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblem.java +++ /dev/null @@ -1,166 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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. - */ - -/** - * Describes a problem that was encountered during settings building. A problem can either be an exception that was - * thrown or a simple string message. In addition, a problem carries a hint about its source, e.g. the settings file - * that exhibits the problem. - * - * @author Benjamin Bentmann - */ -public class DefaultSettingsProblem - implements SettingsProblem -{ - - private final String source; - - private final int lineNumber; - - private final int columnNumber; - - private final String message; - - private final Exception exception; - - private final Severity severity; - - /** - * Creates a new problem with the specified message and exception. - * - * @param message The message describing the problem, may be {@code null}. - * @param severity The severity level of the problem, may be {@code null} to default to - * {@link SettingsProblem.Severity#ERROR}. - * @param source A hint about the source of the problem like a file path, may be {@code null}. - * @param lineNumber The one-based index of the line containing the problem or {@code -1} if unknown. - * @param columnNumber The one-based index of the column containing the problem or {@code -1} if unknown. - * @param exception The exception that caused this problem, may be {@code null}. - */ - public DefaultSettingsProblem( String message, Severity severity, String source, int lineNumber, int columnNumber, - Exception exception ) - { - this.message = message; - this.severity = ( severity != null ) ? severity : Severity.ERROR; - this.source = ( source != null ) ? source : ""; - this.lineNumber = lineNumber; - this.columnNumber = columnNumber; - this.exception = exception; - } - - @Override - public String getSource() - { - return source; - } - - @Override - public int getLineNumber() - { - return lineNumber; - } - - @Override - public int getColumnNumber() - { - return columnNumber; - } - - @Override - public String getLocation() - { - StringBuilder buffer = new StringBuilder( 256 ); - - if ( getSource().length() > 0 ) - { - if ( buffer.length() > 0 ) - { - buffer.append( ", " ); - } - buffer.append( getSource() ); - } - - if ( getLineNumber() > 0 ) - { - if ( buffer.length() > 0 ) - { - buffer.append( ", " ); - } - buffer.append( "line " ).append( getLineNumber() ); - } - - if ( getColumnNumber() > 0 ) - { - if ( buffer.length() > 0 ) - { - buffer.append( ", " ); - } - buffer.append( "column " ).append( getColumnNumber() ); - } - - return buffer.toString(); - } - - @Override - public Exception getException() - { - return exception; - } - - @Override - public String getMessage() - { - String msg; - - if ( message != null && message.length() > 0 ) - { - msg = message; - } - else - { - msg = exception.getMessage(); - - if ( msg == null ) - { - msg = ""; - } - } - - return msg; - } - - @Override - public Severity getSeverity() - { - return severity; - } - - @Override - public String toString() - { - StringBuilder buffer = new StringBuilder( 128 ); - - buffer.append( "[" ).append( getSeverity() ).append( "] " ); - buffer.append( getMessage() ); - buffer.append( " @ " ).append( getLocation() ); - - return buffer.toString(); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblemCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblemCollector.java deleted file mode 100644 index 6721379b..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblemCollector.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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.util.ArrayList; -import java.util.List; - -import org.apache.maven.settings.io.SettingsParseException; - -/** - * Collects problems that are encountered during settings building. - * - * @author Benjamin Bentmann - */ -class DefaultSettingsProblemCollector - implements SettingsProblemCollector -{ - - private List<SettingsProblem> problems; - - private String source; - - public DefaultSettingsProblemCollector( List<SettingsProblem> problems ) - { - this.problems = ( problems != null ) ? problems : new ArrayList<SettingsProblem>(); - } - - public List<SettingsProblem> getProblems() - { - return problems; - } - - public void setSource( String source ) - { - this.source = source; - } - - @Override - public void add( SettingsProblem.Severity severity, String message, int line, int column, Exception cause ) - { - if ( line <= 0 && column <= 0 && ( cause instanceof SettingsParseException ) ) - { - SettingsParseException e = (SettingsParseException) cause; - line = e.getLineNumber(); - column = e.getColumnNumber(); - } - - SettingsProblem problem = new DefaultSettingsProblem( message, severity, source, line, column, cause ); - - problems.add( problem ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/FileSettingsSource.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/FileSettingsSource.java deleted file mode 100644 index 3c2d32ac..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/FileSettingsSource.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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 org.apache.maven.building.FileSource; - -/** - * Wraps an ordinary {@link File} as a settings source. - * - * @author Benjamin Bentmann - * - * @deprecated instead use {@link FileSource} - */ -@Deprecated -public class FileSettingsSource extends FileSource - implements SettingsSource -{ - - /** - * Creates a new settings source backed by the specified file. - * - * @param settingsFile The settings file, must not be {@code null}. - */ - public FileSettingsSource( File settingsFile ) - { - super( settingsFile ); - } - - /** - * Gets the settings file of this model source. - * - * @return The underlying settings file, never {@code null}. - * @deprecated instead use {@link #getFile()} - */ - @Deprecated - public File getSettingsFile() - { - return getFile(); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuilder.java deleted file mode 100644 index 61e34e99..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuilder.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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. - */ - -/** - * Builds the effective settings from a user settings file and/or a global settings file. - * - * @author Benjamin Bentmann - */ -public interface SettingsBuilder -{ - - /** - * Builds the effective settings of the specified settings files. - * - * @param request The settings building request that holds the parameters, must not be {@code null}. - * @return The result of the settings building, never {@code null}. - * @throws SettingsBuildingException If the effective settings could not be built. - */ - SettingsBuildingResult build( SettingsBuildingRequest request ) - throws SettingsBuildingException; - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingException.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingException.java deleted file mode 100644 index f7d48e4b..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingException.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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.PrintWriter; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.List; - -/** - * Signals one ore more errors during settings building. The settings builder tries to collect as many problems as - * possible before eventually failing to provide callers with rich error information. Use {@link #getProblems()} to - * query the details of the failure. - * - * @author Benjamin Bentmann - */ -public class SettingsBuildingException - extends Exception -{ - - private final List<SettingsProblem> problems; - - /** - * Creates a new exception with the specified problems. - * - * @param problems The problems that causes this exception, may be {@code null}. - */ - public SettingsBuildingException( List<SettingsProblem> problems ) - { - super( toMessage( problems ) ); - - this.problems = new ArrayList<SettingsProblem>(); - if ( problems != null ) - { - this.problems.addAll( problems ); - } - } - - /** - * Gets the problems that caused this exception. - * - * @return The problems that caused this exception, never {@code null}. - */ - public List<SettingsProblem> getProblems() - { - return problems; - } - - private static String toMessage( List<SettingsProblem> problems ) - { - StringWriter buffer = new StringWriter( 1024 ); - - PrintWriter writer = new PrintWriter( buffer ); - - writer.print( problems.size() ); - writer.print( ( problems.size() == 1 ) ? " problem was " : " problems were " ); - writer.print( "encountered while building the effective settings" ); - writer.println(); - - for ( SettingsProblem problem : problems ) - { - writer.print( "[" ); - writer.print( problem.getSeverity() ); - writer.print( "] " ); - writer.print( problem.getMessage() ); - writer.print( " @ " ); - writer.println( problem.getLocation() ); - } - - return buffer.toString(); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingRequest.java deleted file mode 100644 index 92d87d80..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingRequest.java +++ /dev/null @@ -1,131 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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.Properties; - -/** - * Collects settings that control the building of effective settings. - * - * @author Benjamin Bentmann - */ -public interface SettingsBuildingRequest -{ - - /** - * Gets the global settings file. - * - * @return The global settings file or {@code null} if none. - */ - File getGlobalSettingsFile(); - - /** - * Sets the global settings file. A non-existent settings file is equivalent to empty settings. If both user - * settings and global settings are given, the user settings take precedence. - * - * @param globalSettingsFile The global settings file, may be {@code null} to disable global settings. - * @return This request, never {@code null}. - */ - SettingsBuildingRequest setGlobalSettingsFile( File globalSettingsFile ); - - /** - * Gets the global settings source. - * - * @return The global settings source or {@code null} if none. - */ - SettingsSource getGlobalSettingsSource(); - - /** - * Sets the global settings source. If both user settings and a global settings are given, the user settings take - * precedence. - * - * @param globalSettingsSource The global settings source, may be {@code null} to disable global settings. - * @return This request, never {@code null}. - */ - SettingsBuildingRequest setGlobalSettingsSource( SettingsSource globalSettingsSource ); - - /** - * Gets the user settings file. - * - * @return The user settings file or {@code null} if none. - */ - File getUserSettingsFile(); - - /** - * Sets the user settings file. A non-existent settings file is equivalent to empty settings. If both a user - * settings file and a global settings file are given, the user settings take precedence. - * - * @param userSettingsFile The user settings file, may be {@code null} to disable user settings. - * @return This request, never {@code null}. - */ - SettingsBuildingRequest setUserSettingsFile( File userSettingsFile ); - - /** - * Gets the user settings source. - * - * @return The user settings source or {@code null} if none. - */ - SettingsSource getUserSettingsSource(); - - /** - * Sets the user settings source. If both user settings and a global settings are given, the user settings take - * precedence. - * - * @param userSettingsSource The user settings source, may be {@code null} to disable user settings. - * @return This request, never {@code null}. - */ - SettingsBuildingRequest setUserSettingsSource( SettingsSource userSettingsSource ); - - /** - * Gets the system properties to use for interpolation. The system properties are collected from the runtime - * environment like {@link System#getProperties()} and environment variables. - * - * @return The system properties, never {@code null}. - */ - Properties getSystemProperties(); - - /** - * Sets the system properties to use for interpolation. The system properties are collected from the runtime - * environment like {@link System#getProperties()} and environment variables. - * - * @param systemProperties The system properties, may be {@code null}. - * @return This request, never {@code null}. - */ - SettingsBuildingRequest setSystemProperties( Properties systemProperties ); - - /** - * Gets the user properties to use for interpolation. The user properties have been configured directly by the user - * on his discretion, e.g. via the {@code -Dkey=value} parameter on the command line. - * - * @return The user properties, never {@code null}. - */ - Properties getUserProperties(); - - /** - * Sets the user properties to use for interpolation. The user properties have been configured directly by the user - * on his discretion, e.g. via the {@code -Dkey=value} parameter on the command line. - * - * @param userProperties The user properties, may be {@code null}. - * @return This request, never {@code null}. - */ - SettingsBuildingRequest setUserProperties( Properties userProperties ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java deleted file mode 100644 index 43b2359f..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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.util.List; - -import org.apache.maven.settings.Settings; - -/** - * Collects the output of the settings builder. - * - * @author Benjamin Bentmann - */ -public interface SettingsBuildingResult -{ - - /** - * Gets the assembled settings. - * - * @return The assembled settings, never {@code null}. - */ - Settings getEffectiveSettings(); - - /** - * Gets the problems that were encountered during the settings building. Note that only problems of severity - * {@link SettingsProblem.Severity#WARNING} and below are reported here. Problems with a higher severity level cause - * the settings builder to fail with a {@link SettingsBuildingException}. - * - * @return The problems that were encountered during the settings building, can be empty but never {@code null}. - */ - List<SettingsProblem> getProblems(); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblem.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblem.java deleted file mode 100644 index e9e563d9..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblem.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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. - */ - -/** - * Describes a problem that was encountered during settings building. A problem can either be an exception that was - * thrown or a simple string message. In addition, a problem carries a hint about its source, e.g. the settings file - * that exhibits the problem. - * - * @author Benjamin Bentmann - */ -public interface SettingsProblem -{ - - /** - * The different severity levels for a problem, in decreasing order. - */ - enum Severity - { - - FATAL, // - ERROR, // - WARNING // - - } - - /** - * Gets the hint about the source of the problem. While the syntax of this hint is unspecified and depends on the - * creator of the problem, the general expectation is that the hint provides sufficient information to the user to - * track the problem back to its origin. A concrete example for such a source hint can be the file path or URL from - * which the settings were read. - * - * @return The hint about the source of the problem or an empty string if unknown, never {@code null}. - */ - String getSource(); - - /** - * Gets the one-based index of the line containing the problem. The line number should refer to some text file that - * is given by {@link #getSource()}. - * - * @return The one-based index of the line containing the problem or a non-positive value if unknown. - */ - int getLineNumber(); - - /** - * Gets the one-based index of the column containing the problem. The column number should refer to some text file - * that is given by {@link #getSource()}. - * - * @return The one-based index of the column containing the problem or non-positive value if unknown. - */ - int getColumnNumber(); - - /** - * Gets the location of the problem. The location is a user-friendly combination of the values from - * {@link #getSource()}, {@link #getLineNumber()} and {@link #getColumnNumber()}. The exact syntax of the returned - * value is undefined. - * - * @return The location of the problem, never {@code null}. - */ - String getLocation(); - - /** - * Gets the exception that caused this problem (if any). - * - * @return The exception that caused this problem or {@code null} if not applicable. - */ - Exception getException(); - - /** - * Gets the message that describes this problem. - * - * @return The message describing this problem, never {@code null}. - */ - String getMessage(); - - /** - * Gets the severity level of this problem. - * - * @return The severity level of this problem, never {@code null}. - */ - Severity getSeverity(); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblemCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblemCollector.java deleted file mode 100644 index 63869c0a..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblemCollector.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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. - */ - -/** - * Collects problems that are encountered during settings building. - * - * @author Benjamin Bentmann - */ -public interface SettingsProblemCollector -{ - - /** - * Adds the specified problem. - * - * @param severity The severity of the problem, must not be {@code null}. - * @param message The detail message of the problem, may be {@code null}. - * @param line The one-based index of the line containing the problem or {@code -1} if unknown. - * @param column The one-based index of the column containing the problem or {@code -1} if unknown. - * @param cause The cause of the problem, may be {@code null}. - */ - void add( SettingsProblem.Severity severity, String message, int line, int column, Exception cause ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsSource.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsSource.java deleted file mode 100644 index 413a3570..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsSource.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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.building.Source; - -/** - * Provides access to the contents of settings independently of the backing store (e.g. file system, database, memory). - * - * @author Benjamin Bentmann - * - * @deprecated instead use {@link Source} - */ -@Deprecated -public interface SettingsSource extends Source -{ - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/StringSettingsSource.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/StringSettingsSource.java deleted file mode 100644 index dbe97580..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/StringSettingsSource.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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.building.StringSource; - -/** - * Wraps an ordinary {@link CharSequence} as a settings source. - * - * @author Benjamin Bentmann - * - * @deprecated instead use {@link StringSource} - */ -@Deprecated -public class StringSettingsSource extends StringSource - implements SettingsSource -{ - - /** - * Creates a new settings source backed by the specified string. - * - * @param settings The settings' string representation, may be empty or {@code null}. - */ - public StringSettingsSource( CharSequence settings ) - { - this( settings, null ); - } - - /** - * Creates a new settings source backed by the specified string. - * - * @param settings The settings' string representation, may be empty or {@code null}. - * @param location The location to report for this use, may be {@code null}. - */ - public StringSettingsSource( CharSequence settings, String location ) - { - super( settings, location ); - } - - /** - * Gets the character sequence of this settings source. - * - * @return The underlying character stream, never {@code null}. - * @deprecated instead use {@link #getContent()} - */ - @Deprecated - public String getSettings() - { - return getContent(); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/UrlSettingsSource.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/UrlSettingsSource.java deleted file mode 100644 index 2b40f648..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/UrlSettingsSource.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.apache.maven.settings.building; - -/* - * 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.net.URL; - -import org.apache.maven.building.UrlSource; - -/** - * Wraps an ordinary {@link URL} as a settings source. - * - * @author Benjamin Bentmann - * - * @deprecated instead use {@link UrlSource} - */ -@Deprecated -public class UrlSettingsSource extends UrlSource - implements SettingsSource -{ - - /** - * Creates a new model source backed by the specified URL. - * - * @param settingsUrl The settings URL, must not be {@code null}. - */ - public UrlSettingsSource( URL settingsUrl ) - { - super( settingsUrl ); - } - - /** - * Gets the settings URL of this model source. - * - * @return The underlying settings URL, never {@code null}. - * @deprecated instead use {@link #getUrl()} - */ - @Deprecated - public URL getSettingsUrl() - { - return getUrl(); - } - -} |