You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2014/12/23 14:09:48 UTC
maven git commit: [MNG-5740]: Add module maven-builder-support Move
Source-code to maven-builder-support and let original classes extend these
Repository: maven
Updated Branches:
refs/heads/master fa71e5f5a -> a7ef70181
[MNG-5740]: Add module maven-builder-support
Move Source-code to maven-builder-support and let original classes extend these
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/a7ef7018
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/a7ef7018
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/a7ef7018
Branch: refs/heads/master
Commit: a7ef70181c1cd62f7886da888c08574620ac1630
Parents: fa71e5f
Author: Robert Scholte <rf...@codehaus.org>
Authored: Tue Dec 23 14:09:01 2014 +0100
Committer: Robert Scholte <rf...@codehaus.org>
Committed: Tue Dec 23 14:09:01 2014 +0100
----------------------------------------------------------------------
maven-builder-support/pom.xml | 49 +++++++++++
.../org/apache/maven/building/FileSource.java | 79 +++++++++++++++++
.../java/org/apache/maven/building/Source.java | 49 +++++++++++
.../org/apache/maven/building/StringSource.java | 90 ++++++++++++++++++++
.../org/apache/maven/building/UrlSource.java | 80 +++++++++++++++++
maven-model-builder/pom.xml | 4 +
.../maven/model/building/FileModelSource.java | 50 ++++-------
.../maven/model/building/ModelSource.java | 24 ++----
.../maven/model/building/StringModelSource.java | 45 ++--------
.../maven/model/building/UrlModelSource.java | 46 ++--------
maven-settings-builder/pom.xml | 5 ++
.../settings/building/FileSettingsSource.java | 40 +++------
.../maven/settings/building/SettingsSource.java | 25 ++----
.../settings/building/StringSettingsSource.java | 37 ++------
.../settings/building/UrlSettingsSource.java | 40 +++------
pom.xml | 8 +-
16 files changed, 432 insertions(+), 239 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-builder-support/pom.xml
----------------------------------------------------------------------
diff --git a/maven-builder-support/pom.xml b/maven-builder-support/pom.xml
new file mode 100644
index 0000000..e70a34a
--- /dev/null
+++ b/maven-builder-support/pom.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven</artifactId>
+ <version>3.2.6-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>maven-builder-support</artifactId>
+
+ <name>Maven Settings</name>
+ <description>Maven Builder Support</description>
+
+ <scm><!-- remove when git scm url format can accept artifact-id at the end, as automatically inherited -->
+ <connection>scm:git:https://git-wip-us.apache.org/repos/asf/maven.git</connection>
+ <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/maven.git</developerConnection>
+ <tag>HEAD</tag>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-builder-support/src/main/java/org/apache/maven/building/FileSource.java
----------------------------------------------------------------------
diff --git a/maven-builder-support/src/main/java/org/apache/maven/building/FileSource.java b/maven-builder-support/src/main/java/org/apache/maven/building/FileSource.java
new file mode 100644
index 0000000..b201ee6
--- /dev/null
+++ b/maven-builder-support/src/main/java/org/apache/maven/building/FileSource.java
@@ -0,0 +1,79 @@
+package org.apache.maven.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.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Wraps an ordinary {@link File} as a source.
+ *
+ * @author Benjamin Bentmann
+ */
+public class FileSource
+ implements Source
+{
+ private final File file;
+
+ /**
+ * Creates a new source backed by the specified file.
+ *
+ * @param file The file, must not be {@code null}.
+ */
+ public FileSource( File file )
+ {
+ if ( file == null )
+ {
+ throw new IllegalArgumentException( "no POM file specified" );
+ }
+ this.file = file.getAbsoluteFile();
+ }
+
+ @Override
+ public InputStream getInputStream()
+ throws IOException
+ {
+ return new FileInputStream( file );
+ }
+
+ @Override
+ public String getLocation()
+ {
+ return file.getPath();
+ }
+
+ /**
+ * Gets the file of this source.
+ *
+ * @return The underlying file, never {@code null}.
+ */
+ public File getFile()
+ {
+ return file;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getLocation();
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-builder-support/src/main/java/org/apache/maven/building/Source.java
----------------------------------------------------------------------
diff --git a/maven-builder-support/src/main/java/org/apache/maven/building/Source.java b/maven-builder-support/src/main/java/org/apache/maven/building/Source.java
new file mode 100644
index 0000000..1f7510b
--- /dev/null
+++ b/maven-builder-support/src/main/java/org/apache/maven/building/Source.java
@@ -0,0 +1,49 @@
+package org.apache.maven.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.IOException;
+import java.io.InputStream;
+
+/**
+ * Provides access to the contents of a source independently of the backing store (e.g. file system, database, memory).
+ *
+ * @author Benjamin Bentmann
+ */
+public interface Source
+{
+
+ /**
+ * Gets a byte stream to the source contents. Closing the returned stream is the responsibility of the caller.
+ *
+ * @return A byte stream to the source contents, never {@code null}.
+ */
+ InputStream getInputStream()
+ throws IOException;
+
+ /**
+ * Provides a user-friendly hint about the location of the source. This could be a local file path, a URI or just an
+ * empty string. The intention is to assist users during error reporting.
+ *
+ * @return A user-friendly hint about the location of the source, never {@code null}.
+ */
+ String getLocation();
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-builder-support/src/main/java/org/apache/maven/building/StringSource.java
----------------------------------------------------------------------
diff --git a/maven-builder-support/src/main/java/org/apache/maven/building/StringSource.java b/maven-builder-support/src/main/java/org/apache/maven/building/StringSource.java
new file mode 100644
index 0000000..f9d87c0
--- /dev/null
+++ b/maven-builder-support/src/main/java/org/apache/maven/building/StringSource.java
@@ -0,0 +1,90 @@
+package org.apache.maven.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.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Wraps an ordinary {@link CharSequence} as a source.
+ *
+ * @author Benjamin Bentmann
+ */
+public class StringSource
+ implements Source
+{
+
+ private String content;
+
+ private String location;
+
+ /**
+ * Creates a new source backed by the specified string.
+ *
+ * @param content The String representation, may be empty or {@code null}.
+ */
+ public StringSource( CharSequence content )
+ {
+ this( content, null );
+ }
+
+ /**
+ * Creates a new source backed by the specified string.
+ *
+ * @param content The String representation, may be empty or {@code null}.
+ * @param location The location to report for this use, may be {@code null}.
+ */
+ public StringSource( CharSequence content, String location )
+ {
+ this.content = ( content != null ) ? content.toString() : "";
+ this.location = ( location != null ) ? location : "(memory)";
+ }
+
+ @Override
+ public InputStream getInputStream()
+ throws IOException
+ {
+ return new ByteArrayInputStream( content.getBytes( "UTF-8" ) );
+ }
+
+ @Override
+ public String getLocation()
+ {
+ return location;
+ }
+
+ /**
+ * Gets the content of this source.
+ *
+ * @return The underlying character stream, never {@code null}.
+ */
+ public String getContent()
+ {
+ return content;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getLocation();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-builder-support/src/main/java/org/apache/maven/building/UrlSource.java
----------------------------------------------------------------------
diff --git a/maven-builder-support/src/main/java/org/apache/maven/building/UrlSource.java b/maven-builder-support/src/main/java/org/apache/maven/building/UrlSource.java
new file mode 100644
index 0000000..7a6e9b0
--- /dev/null
+++ b/maven-builder-support/src/main/java/org/apache/maven/building/UrlSource.java
@@ -0,0 +1,80 @@
+package org.apache.maven.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.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+/**
+ * Wraps an ordinary {@link URL} as a source.
+ *
+ * @author Benjamin Bentmann
+ */
+public class UrlSource
+ implements Source
+{
+
+ private URL url;
+
+ /**
+ * Creates a new source backed by the specified URL.
+ *
+ * @param url The file, must not be {@code null}.
+ */
+ public UrlSource( URL url )
+ {
+ if ( url == null )
+ {
+ throw new IllegalArgumentException( "no POM URL specified" );
+ }
+ this.url = url;
+ }
+
+ @Override
+ public InputStream getInputStream()
+ throws IOException
+ {
+ return url.openStream();
+ }
+
+ @Override
+ public String getLocation()
+ {
+ return url.toString();
+ }
+
+ /**
+ * Gets the URL of this source.
+ *
+ * @return The underlying URL, never {@code null}.
+ */
+ public URL getUrl()
+ {
+ return url;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getLocation();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-model-builder/pom.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/pom.xml b/maven-model-builder/pom.xml
index 8f29f59..738f64f 100644
--- a/maven-model-builder/pom.xml
+++ b/maven-model-builder/pom.xml
@@ -47,6 +47,10 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-builder-support</artifactId>
+ </dependency>
<dependency>
<groupId>org.eclipse.sisu</groupId>
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-model-builder/src/main/java/org/apache/maven/model/building/FileModelSource.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/FileModelSource.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/FileModelSource.java
index fcc85a8..a2e1141 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/FileModelSource.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/FileModelSource.java
@@ -20,20 +20,17 @@ package org.apache.maven.model.building;
*/
import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
import java.net.URI;
+import org.apache.maven.building.FileSource;
+
/**
* Wraps an ordinary {@link File} as a model source.
*
* @author Benjamin Bentmann
*/
-public class FileModelSource
- implements ModelSource2
+public class FileModelSource extends FileSource implements ModelSource2
{
- private final File pomFile;
/**
* Creates a new model source backed by the specified file.
@@ -42,45 +39,27 @@ public class FileModelSource
*/
public FileModelSource( File pomFile )
{
- if ( pomFile == null )
- {
- throw new IllegalArgumentException( "no POM file specified" );
- }
- this.pomFile = pomFile.getAbsoluteFile();
- }
-
- public InputStream getInputStream()
- throws IOException
- {
- return new FileInputStream( pomFile );
- }
-
- public String getLocation()
- {
- return pomFile.getPath();
+ super( pomFile );
}
-
+
/**
- * Gets the POM file of this model source.
- *
- * @return The underlying POM file, never {@code null}.
+ *
+ * @return the file of this source
+ *
+ * @deprecated instead use {@link #getFile()}
*/
+ @Deprecated
public File getPomFile()
{
- return pomFile;
+ return getFile();
}
-
+
@Override
- public String toString()
- {
- return getLocation();
- }
-
public ModelSource2 getRelatedSource( String relPath )
{
relPath = relPath.replace( '\\', File.separatorChar ).replace( '/', File.separatorChar );
- File relatedPom = new File( pomFile.getParentFile(), relPath );
+ File relatedPom = new File( getFile().getParentFile(), relPath );
if ( relatedPom.isDirectory() )
{
@@ -96,8 +75,9 @@ public class FileModelSource
return null;
}
+ @Override
public URI getLocationURI()
{
- return pomFile.toURI();
+ return getFile().toURI();
}
}
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelSource.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelSource.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelSource.java
index dc648bf..acb4651 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelSource.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelSource.java
@@ -1,5 +1,7 @@
package org.apache.maven.model.building;
+import org.apache.maven.building.Source;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,8 +21,6 @@ package org.apache.maven.model.building;
* under the License.
*/
-import java.io.IOException;
-import java.io.InputStream;
/**
* Provides access to the contents of a POM independently of the backing store (e.g. file system, database, memory).
@@ -30,24 +30,10 @@ import java.io.InputStream;
*
* @author Benjamin Bentmann
* @see ModelSource2
+ * @deprecated instead use {@link Source}
*/
-public interface ModelSource
+@Deprecated
+public interface ModelSource extends org.apache.maven.building.Source
{
- /**
- * Gets a byte stream to the POM contents. Closing the returned stream is the responsibility of the caller.
- *
- * @return A byte stream to the POM contents, never {@code null}.
- */
- InputStream getInputStream()
- throws IOException;
-
- /**
- * Provides a user-friendly hint about the location of the POM. This could be a local file path, a URI or just an
- * empty string. The intention is to assist users during error reporting.
- *
- * @return A user-friendly hint about the location of the POM, never {@code null}.
- */
- String getLocation();
-
}
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-model-builder/src/main/java/org/apache/maven/model/building/StringModelSource.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/StringModelSource.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/StringModelSource.java
index edc4d31..1d8406f 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/StringModelSource.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/StringModelSource.java
@@ -1,5 +1,7 @@
package org.apache.maven.model.building;
+import org.apache.maven.building.StringSource;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,23 +21,19 @@ package org.apache.maven.model.building;
* under the License.
*/
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
/**
* Wraps an ordinary {@link CharSequence} as a model source.
*
* @author Benjamin Bentmann
+ *
+ * @deprecated instead use {@link StringSource}
*/
-public class StringModelSource
+@Deprecated
+public class StringModelSource extends org.apache.maven.building.StringSource
implements ModelSource
{
- private String pom;
-
- private String location;
-
/**
* Creates a new model source backed by the specified string.
*
@@ -54,35 +52,6 @@ public class StringModelSource
*/
public StringModelSource( CharSequence pom, String location )
{
- this.pom = ( pom != null ) ? pom.toString() : "";
- this.location = ( location != null ) ? location : "(memory)";
- }
-
- public InputStream getInputStream()
- throws IOException
- {
- return new ByteArrayInputStream( pom.getBytes( "UTF-8" ) );
+ super( pom, location );
}
-
- public String getLocation()
- {
- return location;
- }
-
- /**
- * Gets the character sequence of this model source.
- *
- * @return The underlying character stream, never {@code null}.
- */
- public String getModel()
- {
- return pom;
- }
-
- @Override
- public String toString()
- {
- return getLocation();
- }
-
}
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-model-builder/src/main/java/org/apache/maven/model/building/UrlModelSource.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/UrlModelSource.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/UrlModelSource.java
index 07058b3..6ed25ed 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/building/UrlModelSource.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/UrlModelSource.java
@@ -19,21 +19,21 @@ package org.apache.maven.model.building;
* under the License.
*/
-import java.io.IOException;
-import java.io.InputStream;
import java.net.URL;
+import org.apache.maven.building.UrlSource;
+
/**
* Wraps an ordinary {@link URL} as a model source.
*
* @author Benjamin Bentmann
+ *
+ * @deprecated instead use {@link UrlSource}
*/
-public class UrlModelSource
+@Deprecated
+public class UrlModelSource extends org.apache.maven.building.UrlSource
implements ModelSource
{
-
- private URL pomUrl;
-
/**
* Creates a new model source backed by the specified URL.
*
@@ -41,38 +41,6 @@ public class UrlModelSource
*/
public UrlModelSource( URL pomUrl )
{
- if ( pomUrl == null )
- {
- throw new IllegalArgumentException( "no POM URL specified" );
- }
- this.pomUrl = pomUrl;
- }
-
- public InputStream getInputStream()
- throws IOException
- {
- return pomUrl.openStream();
+ super( pomUrl );
}
-
- public String getLocation()
- {
- return pomUrl.toString();
- }
-
- /**
- * Gets the POM URL of this model source.
- *
- * @return The underlying POM URL, never {@code null}.
- */
- public URL getPomUrl()
- {
- return pomUrl;
- }
-
- @Override
- public String toString()
- {
- return getLocation();
- }
-
}
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-settings-builder/pom.xml
----------------------------------------------------------------------
diff --git a/maven-settings-builder/pom.xml b/maven-settings-builder/pom.xml
index 14cdeb3..2d109f4 100644
--- a/maven-settings-builder/pom.xml
+++ b/maven-settings-builder/pom.xml
@@ -41,6 +41,11 @@ under the License.
<dependencies>
<dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-builder-support</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-settings-builder/src/main/java/org/apache/maven/settings/building/FileSettingsSource.java
----------------------------------------------------------------------
diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/FileSettingsSource.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/FileSettingsSource.java
index a821e08..3c2d32a 100644
--- a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/FileSettingsSource.java
+++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/FileSettingsSource.java
@@ -20,21 +20,21 @@ package org.apache.maven.settings.building;
*/
import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
+
+import org.apache.maven.building.FileSource;
/**
* Wraps an ordinary {@link File} as a settings source.
*
* @author Benjamin Bentmann
+ *
+ * @deprecated instead use {@link FileSource}
*/
-public class FileSettingsSource
+@Deprecated
+public class FileSettingsSource extends FileSource
implements SettingsSource
{
- private File settingsFile;
-
/**
* Creates a new settings source backed by the specified file.
*
@@ -42,38 +42,18 @@ public class FileSettingsSource
*/
public FileSettingsSource( File settingsFile )
{
- if ( settingsFile == null )
- {
- throw new IllegalArgumentException( "no settings file specified" );
- }
- this.settingsFile = settingsFile.getAbsoluteFile();
- }
-
- public InputStream getInputStream()
- throws IOException
- {
- return new FileInputStream( settingsFile );
- }
-
- public String getLocation()
- {
- return settingsFile.getPath();
+ 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 settingsFile;
- }
-
- @Override
- public String toString()
- {
- return getLocation();
+ return getFile();
}
-
}
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsSource.java
----------------------------------------------------------------------
diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsSource.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsSource.java
index 3297ab4..413a357 100644
--- a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsSource.java
+++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsSource.java
@@ -19,32 +19,17 @@ package org.apache.maven.settings.building;
* under the License.
*/
-import java.io.IOException;
-import java.io.InputStream;
+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}
*/
-public interface SettingsSource
+@Deprecated
+public interface SettingsSource extends Source
{
- /**
- * Gets a byte stream to the settings contents. Closing the returned stream is the responsibility of the caller.
- * Note that each invocation of this method returns a new/fresh stream which represents the entire contents.
- *
- * @return A byte stream to the settings contents, never {@code null}.
- */
- InputStream getInputStream()
- throws IOException;
-
- /**
- * Provides a user-friendly hint about the location of the settings. This could be a local file path, a URI or just
- * an empty string. The intention is to assist users during error reporting.
- *
- * @return A user-friendly hint about the location of the settings, never {@code null}.
- */
- String getLocation();
-
}
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-settings-builder/src/main/java/org/apache/maven/settings/building/StringSettingsSource.java
----------------------------------------------------------------------
diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/StringSettingsSource.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/StringSettingsSource.java
index 5136f1b..dbe9758 100644
--- a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/StringSettingsSource.java
+++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/StringSettingsSource.java
@@ -19,23 +19,20 @@ package org.apache.maven.settings.building;
* under the License.
*/
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import org.apache.maven.building.StringSource;
/**
* Wraps an ordinary {@link CharSequence} as a settings source.
*
* @author Benjamin Bentmann
+ *
+ * @deprecated instead use {@link StringSource}
*/
-public class StringSettingsSource
+@Deprecated
+public class StringSettingsSource extends StringSource
implements SettingsSource
{
- private String settings;
-
- private String location;
-
/**
* Creates a new settings source backed by the specified string.
*
@@ -54,35 +51,19 @@ public class StringSettingsSource
*/
public StringSettingsSource( CharSequence settings, String location )
{
- this.settings = ( settings != null ) ? settings.toString() : "";
- this.location = ( location != null ) ? location : "(memory)";
- }
-
- public InputStream getInputStream()
- throws IOException
- {
- return new ByteArrayInputStream( settings.getBytes( "UTF-8" ) );
- }
-
- public String getLocation()
- {
- return 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 settings;
- }
-
- @Override
- public String toString()
- {
- return getLocation();
+ return getContent();
}
}
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/maven-settings-builder/src/main/java/org/apache/maven/settings/building/UrlSettingsSource.java
----------------------------------------------------------------------
diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/UrlSettingsSource.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/UrlSettingsSource.java
index 04a09f6..2b40f64 100644
--- a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/UrlSettingsSource.java
+++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/UrlSettingsSource.java
@@ -19,21 +19,22 @@ package org.apache.maven.settings.building;
* under the License.
*/
-import java.io.IOException;
-import java.io.InputStream;
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}
*/
-public class UrlSettingsSource
+@Deprecated
+public class UrlSettingsSource extends UrlSource
implements SettingsSource
{
- private URL settingsUrl;
-
/**
* Creates a new model source backed by the specified URL.
*
@@ -41,38 +42,19 @@ public class UrlSettingsSource
*/
public UrlSettingsSource( URL settingsUrl )
{
- if ( settingsUrl == null )
- {
- throw new IllegalArgumentException( "no settings URL specified" );
- }
- this.settingsUrl = settingsUrl;
- }
-
- public InputStream getInputStream()
- throws IOException
- {
- return settingsUrl.openStream();
- }
-
- public String getLocation()
- {
- return settingsUrl.toString();
+ 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 settingsUrl;
- }
-
- @Override
- public String toString()
- {
- return getLocation();
+ return getUrl();
}
-
+
}
http://git-wip-us.apache.org/repos/asf/maven/blob/a7ef7018/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 981e3ef..8cbaa9d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -73,6 +73,7 @@
<modules>
<module>maven-plugin-api</module>
+ <module>maven-builder-support</module>
<module>maven-model</module>
<module>maven-model-builder</module>
<module>maven-core</module>
@@ -197,6 +198,11 @@
<artifactId>maven-repository-metadata</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-builder-support</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!--bootstrap-end-comment-->
<!-- Plexus -->
<dependency>
@@ -488,7 +494,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
- <version>1.10</version>
+ <version>1.14-SNAPSHOT</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>