null
if the entry does not exist.
*/
- protected Entry get( DirectoryEntry parent, String name )
- {
+ protected Entry get(DirectoryEntry parent, String name) {
parent.getClass();
- Entry[] entries = listEntries( parent );
- if ( entries != null )
- {
- for ( Entry entry : entries )
- {
- if ( name.equals( entry.getName() ) )
- {
+ Entry[] entries = listEntries(parent);
+ if (entries != null) {
+ for (Entry entry : entries) {
+ if (name.equals(entry.getName())) {
return entry;
}
}
@@ -103,34 +91,28 @@ protected Entry get( DirectoryEntry parent, String name )
/**
* {@inheritDoc}
*/
- public DirectoryEntry mkdir( DirectoryEntry parent, String name )
- {
+ public DirectoryEntry mkdir(DirectoryEntry parent, String name) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
- public FileEntry put( DirectoryEntry parent, String name, InputStream content )
- throws IOException
- {
+ public FileEntry put(DirectoryEntry parent, String name, InputStream content) throws IOException {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
- public FileEntry put( DirectoryEntry parent, String name, byte[] content )
- throws IOException
- {
- return put( parent, name, new ByteArrayInputStream( content ) );
+ public FileEntry put(DirectoryEntry parent, String name, byte[] content) throws IOException {
+ return put(parent, name, new ByteArrayInputStream(content));
}
/**
* {@inheritDoc}
*/
- public void remove( Entry entry )
- {
+ public void remove(Entry entry) {
throw new UnsupportedOperationException();
}
}
diff --git a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/DefaultDirectoryEntry.java b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/DefaultDirectoryEntry.java
index 9aa097af..95a3d640 100644
--- a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/DefaultDirectoryEntry.java
+++ b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/DefaultDirectoryEntry.java
@@ -23,10 +23,7 @@
*
* @since 1.0
*/
-public class DefaultDirectoryEntry
- extends AbstractEntry
- implements DirectoryEntry
-{
+public class DefaultDirectoryEntry extends AbstractEntry implements DirectoryEntry {
/**
* Ensure consistent serialization.
*
@@ -42,9 +39,8 @@ public class DefaultDirectoryEntry
* @param name The name of the entry (or the empty string if this is the root entry).
* @since 1.0
*/
- public DefaultDirectoryEntry( FileSystem fileSystem, DirectoryEntry parent, String name )
- {
- super( fileSystem, parent, name );
+ public DefaultDirectoryEntry(FileSystem fileSystem, DirectoryEntry parent, String name) {
+ super(fileSystem, parent, name);
}
/**
@@ -56,25 +52,20 @@ public DefaultDirectoryEntry( FileSystem fileSystem, DirectoryEntry parent, Stri
* @return a {@link DirectoryEntry} in the target filesystem.
* @since 1.0
*/
- public static DirectoryEntry equivalent( FileSystem target, DirectoryEntry directory )
- {
- if ( target.equals( directory.getFileSystem() ) )
- {
+ public static DirectoryEntry equivalent(FileSystem target, DirectoryEntry directory) {
+ if (target.equals(directory.getFileSystem())) {
return directory;
}
- if ( directory.getParent() == null )
- {
+ if (directory.getParent() == null) {
return target.getRoot();
}
- return new DefaultDirectoryEntry( target, equivalent( target, directory.getParent() ), directory.getName() );
+ return new DefaultDirectoryEntry(target, equivalent(target, directory.getParent()), directory.getName());
}
/**
* {@inheritDoc}
*/
- public long getLastModified()
- throws IOException
- {
- return getFileSystem().getLastModified( this );
+ public long getLastModified() throws IOException {
+ return getFileSystem().getLastModified(this);
}
}
diff --git a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/DirectoryEntry.java b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/DirectoryEntry.java
index 41324f69..b3611659 100644
--- a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/DirectoryEntry.java
+++ b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/DirectoryEntry.java
@@ -21,7 +21,4 @@
*
* @since 1.0
*/
-public interface DirectoryEntry
- extends Entry
-{
-}
+public interface DirectoryEntry extends Entry {}
diff --git a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/Entry.java b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/Entry.java
index f437f296..54a4f3e8 100644
--- a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/Entry.java
+++ b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/Entry.java
@@ -23,9 +23,7 @@
*
* @since 1.0
*/
-public interface Entry
- extends Serializable
-{
+public interface Entry extends Serializable {
/**
* Returns the repository that this entry belongs to.
@@ -62,8 +60,7 @@ public interface Entry
* @throws IOException if an I/O error occurs.
* @since 1.0
*/
- long getLastModified()
- throws IOException;
+ long getLastModified() throws IOException;
/**
* Returns the path of this entry relative to the root of the filesystem.
diff --git a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/FileEntry.java b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/FileEntry.java
index a09fe254..4227f864 100644
--- a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/FileEntry.java
+++ b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/FileEntry.java
@@ -24,9 +24,7 @@
*
* @since 1.0
*/
-public interface FileEntry
- extends Entry
-{
+public interface FileEntry extends Entry {
/**
* Returns the size in bytes of the entry.
*
@@ -34,8 +32,7 @@ public interface FileEntry
* @throws IOException if an I/O error occurs.
* @since 1.0
*/
- long getSize()
- throws IOException;
+ long getSize() throws IOException;
/**
* Returns the contents of the entry.
@@ -44,6 +41,5 @@ long getSize()
* @throws IOException if an I/O error occurs.
* @since 1.0
*/
- InputStream getInputStream()
- throws IOException;
+ InputStream getInputStream() throws IOException;
}
diff --git a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/FileSystem.java b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/FileSystem.java
index f9348909..22be5867 100644
--- a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/FileSystem.java
+++ b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/FileSystem.java
@@ -25,9 +25,7 @@
*
* @since 1.0
*/
-public interface FileSystem
- extends Serializable
-{
+public interface FileSystem extends Serializable {
/**
* Lists the entries in the specified directory. Some implementations may be lazy caching
* implementations, in which case it is permitted to return either an empty array, or only those entries which
@@ -41,7 +39,7 @@ public interface FileSystem
* modify the returned array.
* @since 1.0
*/
- Entry[] listEntries( DirectoryEntry directory );
+ Entry[] listEntries(DirectoryEntry directory);
/**
* Returns the root directory entry.
@@ -59,7 +57,7 @@ public interface FileSystem
* @return the {@link Entry} or null
if the path definitely does not exist.
* @since 1.0
*/
- Entry get( String path );
+ Entry get(String path);
/**
* Returns the time that the specified directory entry was last modified. Note:
@@ -73,8 +71,7 @@ public interface FileSystem
* @throws IOException if an I/O error occurs.
* @since 1.0
*/
- long getLastModified( DirectoryEntry entry )
- throws IOException;
+ long getLastModified(DirectoryEntry entry) throws IOException;
/**
* Makes the specified child directory.
@@ -85,7 +82,7 @@ long getLastModified( DirectoryEntry entry )
* @throws UnsupportedOperationException if the repository is read-only.
* @since 1.0
*/
- DirectoryEntry mkdir( DirectoryEntry parent, String name );
+ DirectoryEntry mkdir(DirectoryEntry parent, String name);
/**
* Puts the specified content into a the specified directory.
@@ -98,8 +95,7 @@ long getLastModified( DirectoryEntry entry )
* @throws java.io.IOException if the content could not be read/written.
* @since 1.0
*/
- FileEntry put( DirectoryEntry parent, String name, InputStream content )
- throws IOException;
+ FileEntry put(DirectoryEntry parent, String name, InputStream content) throws IOException;
/**
* Puts the specified content into a the specified directory.
@@ -112,8 +108,7 @@ FileEntry put( DirectoryEntry parent, String name, InputStream content )
* @throws java.io.IOException if the content could not be read/written.
* @since 1.0
*/
- FileEntry put( DirectoryEntry parent, String name, byte[] content )
- throws IOException;
+ FileEntry put(DirectoryEntry parent, String name, byte[] content) throws IOException;
/**
* Removes the specified entry (and if the entry is a directory, all its children).
@@ -122,5 +117,5 @@ FileEntry put( DirectoryEntry parent, String name, byte[] content )
* @throws UnsupportedOperationException if the repository is read-only.
* @since 1.0
*/
- void remove( Entry entry );
+ void remove(Entry entry);
}
diff --git a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/ArchetypeCatalogNotFoundException.java b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/ArchetypeCatalogNotFoundException.java
index a1b47257..c52db06a 100644
--- a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/ArchetypeCatalogNotFoundException.java
+++ b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/ArchetypeCatalogNotFoundException.java
@@ -21,9 +21,7 @@
*
* @since 1.0
*/
-public class ArchetypeCatalogNotFoundException
- extends Exception
-{
+public class ArchetypeCatalogNotFoundException extends Exception {
/**
* Ensure consistent serialization.
*
@@ -36,8 +34,7 @@ public class ArchetypeCatalogNotFoundException
*
* @since 1.0
*/
- public ArchetypeCatalogNotFoundException()
- {
+ public ArchetypeCatalogNotFoundException() {
super();
}
@@ -47,9 +44,8 @@ public ArchetypeCatalogNotFoundException()
* @param message The message.
* @since 1.0
*/
- public ArchetypeCatalogNotFoundException( String message )
- {
- this( message, null );
+ public ArchetypeCatalogNotFoundException(String message) {
+ this(message, null);
}
/**
@@ -59,8 +55,7 @@ public ArchetypeCatalogNotFoundException( String message )
* @param cause the reason why it was not found (or null
if there is no specific reason)
* @since 1.0
*/
- public ArchetypeCatalogNotFoundException( String message, Throwable cause )
- {
- super( message, cause );
+ public ArchetypeCatalogNotFoundException(String message, Throwable cause) {
+ super(message, cause);
}
}
diff --git a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/Artifact.java b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/Artifact.java
index a047ac75..ee471d5f 100644
--- a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/Artifact.java
+++ b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/Artifact.java
@@ -30,9 +30,7 @@
* @serial
* @since 1.0
*/
-public final class Artifact
- implements Serializable, Comparabletimestamp!=null
)
* @since 1.0
*/
- private Artifact( String groupId, String artifactId, String version, String classifier, String type, Long timestamp,
- Integer buildNumber )
- {
+ private Artifact(
+ String groupId,
+ String artifactId,
+ String version,
+ String classifier,
+ String type,
+ Long timestamp,
+ Integer buildNumber) {
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
@@ -144,11 +147,15 @@ private Artifact( String groupId, String artifactId, String version, String clas
* @param buildNumber The build number.
* @since 1.0
*/
- public Artifact( String groupId, String artifactId, String version, String classifier, String type, long timestamp,
- int buildNumber )
- {
- this( groupId, artifactId, version, classifier, type, Long.valueOf( timestamp ),
- Integer.valueOf( buildNumber ) );
+ public Artifact(
+ String groupId,
+ String artifactId,
+ String version,
+ String classifier,
+ String type,
+ long timestamp,
+ int buildNumber) {
+ this(groupId, artifactId, version, classifier, type, Long.valueOf(timestamp), Integer.valueOf(buildNumber));
}
/**
@@ -162,9 +169,8 @@ public Artifact( String groupId, String artifactId, String version, String class
* @param buildNumber The build number.
* @since 1.0
*/
- public Artifact( String groupId, String artifactId, String version, String type, long timestamp, int buildNumber )
- {
- this( groupId, artifactId, version, null, type, new Long( timestamp ), new Integer( buildNumber ) );
+ public Artifact(String groupId, String artifactId, String version, String type, long timestamp, int buildNumber) {
+ this(groupId, artifactId, version, null, type, new Long(timestamp), new Integer(buildNumber));
}
/**
@@ -177,9 +183,8 @@ public Artifact( String groupId, String artifactId, String version, String type,
* @param type The type.
* @since 1.0
*/
- public Artifact( String groupId, String artifactId, String version, String classifier, String type )
- {
- this( groupId, artifactId, version, classifier, type, null, null );
+ public Artifact(String groupId, String artifactId, String version, String classifier, String type) {
+ this(groupId, artifactId, version, classifier, type, null, null);
}
/**
@@ -191,9 +196,8 @@ public Artifact( String groupId, String artifactId, String version, String class
* @param type The type.
* @since 1.0
*/
- public Artifact( String groupId, String artifactId, String version, String type )
- {
- this( groupId, artifactId, version, null, type );
+ public Artifact(String groupId, String artifactId, String version, String type) {
+ this(groupId, artifactId, version, null, type);
}
/**
@@ -202,12 +206,12 @@ public Artifact( String groupId, String artifactId, String version, String type
* @return the name of the artifact.
* @since 1.0
*/
- public String getName()
- {
- if ( name == null )
- {
- name = MessageFormat.format( "{0}-{1}{2}.{3}", new Object[] {artifactId, getTimestampVersion(),
- ( classifier == null ? "" : "-" + classifier ), type} );
+ public String getName() {
+ if (name == null) {
+ name = MessageFormat.format(
+ "{0}-{1}{2}.{3}",
+ new Object[] {artifactId, getTimestampVersion(), (classifier == null ? "" : "-" + classifier), type
+ });
}
return name;
}
@@ -218,8 +222,7 @@ public String getName()
* @return the groupId of the artifact.
* @since 1.0
*/
- public String getGroupId()
- {
+ public String getGroupId() {
return groupId;
}
@@ -229,8 +232,7 @@ public String getGroupId()
* @return the artifactId of the artifact.
* @since 1.0
*/
- public String getArtifactId()
- {
+ public String getArtifactId() {
return artifactId;
}
@@ -240,8 +242,7 @@ public String getArtifactId()
* @return the version of the artifact.
* @since 1.0
*/
- public String getVersion()
- {
+ public String getVersion() {
return version;
}
@@ -251,8 +252,7 @@ public String getVersion()
* @return the type of the artifact.
* @since 1.0
*/
- public String getType()
- {
+ public String getType() {
return type;
}
@@ -262,8 +262,7 @@ public String getType()
* @return the classifier of the artifact (may be null
).
* @since 1.0
*/
- public String getClassifier()
- {
+ public String getClassifier() {
return classifier;
}
@@ -273,8 +272,7 @@ public String getClassifier()
* @return the timestamp of the artifact (may be null
).
* @since 1.0
*/
- public Long getTimestamp()
- {
+ public Long getTimestamp() {
return timestamp;
}
@@ -284,8 +282,7 @@ public Long getTimestamp()
* @return the build number of the artifact (may be null
).
* @since 1.0
*/
- public Integer getBuildNumber()
- {
+ public Integer getBuildNumber() {
return buildNumber;
}
@@ -297,17 +294,13 @@ public Integer getBuildNumber()
* (may be null
).
* @since 1.0
*/
- public String getTimestampString()
- {
- if ( timestamp == null )
- {
+ public String getTimestampString() {
+ if (timestamp == null) {
return null;
- }
- else
- {
- SimpleDateFormat fmt = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
- fmt.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
- return fmt.format( new Date( timestamp.longValue() ) );
+ } else {
+ SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd.HHmmss");
+ fmt.setTimeZone(TimeZone.getTimeZone("GMT"));
+ return fmt.format(new Date(timestamp.longValue()));
}
}
@@ -323,21 +316,20 @@ public String getTimestampString()
* @return the timestamp version.
* @since 1.0
*/
- public String getTimestampVersion()
- {
- if ( timestampVersion == null )
- {
- if ( timestamp != null )
- {
+ public String getTimestampVersion() {
+ if (timestampVersion == null) {
+ if (timestamp != null) {
assert isSnapshot();
- SimpleDateFormat fmt = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
- fmt.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
- timestampVersion = MessageFormat.format( "{0}-{1}-{2}", new Object[] {
- this.version.substring( 0, this.version.length() - "-SNAPSHOT".length() ),
- fmt.format( new Date( timestamp.longValue() ) ), buildNumber} );
- }
- else
- {
+ SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd.HHmmss");
+ fmt.setTimeZone(TimeZone.getTimeZone("GMT"));
+ timestampVersion = MessageFormat.format(
+ "{0}-{1}-{2}",
+ new Object[] {
+ this.version.substring(0, this.version.length() - "-SNAPSHOT".length()),
+ fmt.format(new Date(timestamp.longValue())),
+ buildNumber
+ });
+ } else {
timestampVersion = version;
}
}
@@ -350,53 +342,42 @@ public String getTimestampVersion()
* @return true
if and only if the artifact is a SNAPSHOT artifact.
* @since 1.0
*/
- public boolean isSnapshot()
- {
- return version.endsWith( "-SNAPSHOT" );
+ public boolean isSnapshot() {
+ return version.endsWith("-SNAPSHOT");
}
/**
* {@inheritDoc}
*/
- public boolean equals( Object o )
- {
- if ( this == o )
- {
+ public boolean equals(Object o) {
+ if (this == o) {
return true;
}
- if ( o == null || getClass() != o.getClass() )
- {
+ if (o == null || getClass() != o.getClass()) {
return false;
}
Artifact artifact = (Artifact) o;
- if ( !groupId.equals( artifact.groupId ) )
- {
+ if (!groupId.equals(artifact.groupId)) {
return false;
}
- if ( !artifactId.equals( artifact.artifactId ) )
- {
+ if (!artifactId.equals(artifact.artifactId)) {
return false;
}
- if ( !version.equals( artifact.version ) )
- {
+ if (!version.equals(artifact.version)) {
return false;
}
- if ( !type.equals( artifact.type ) )
- {
+ if (!type.equals(artifact.type)) {
return false;
}
- if ( !Objects.equals( classifier, artifact.classifier ) )
- {
+ if (!Objects.equals(classifier, artifact.classifier)) {
return false;
}
- if ( !Objects.equals( buildNumber, artifact.buildNumber ) )
- {
+ if (!Objects.equals(buildNumber, artifact.buildNumber)) {
return false;
}
- if ( !Objects.equals( timestamp, artifact.timestamp ) )
- {
+ if (!Objects.equals(timestamp, artifact.timestamp)) {
return false;
}
@@ -411,31 +392,24 @@ public boolean equals( Object o )
* for SNAPSHOT versions).
* @since 1.0
*/
- public boolean equalSnapshots( Artifact artifact )
- {
- if ( this == artifact )
- {
+ public boolean equalSnapshots(Artifact artifact) {
+ if (this == artifact) {
return true;
}
- if ( !groupId.equals( artifact.groupId ) )
- {
+ if (!groupId.equals(artifact.groupId)) {
return false;
}
- if ( !artifactId.equals( artifact.artifactId ) )
- {
+ if (!artifactId.equals(artifact.artifactId)) {
return false;
}
- if ( !version.equals( artifact.version ) )
- {
+ if (!version.equals(artifact.version)) {
return false;
}
- if ( !type.equals( artifact.type ) )
- {
+ if (!type.equals(artifact.type)) {
return false;
}
- if ( !Objects.equals( classifier, artifact.classifier ) )
- {
+ if (!Objects.equals(classifier, artifact.classifier)) {
return false;
}
@@ -445,41 +419,37 @@ public boolean equalSnapshots( Artifact artifact )
/**
* {@inheritDoc}
*/
- public int hashCode()
- {
+ public int hashCode() {
int result = groupId.hashCode();
result = 31 * result + artifactId.hashCode();
result = 31 * result + version.hashCode();
result = 31 * result + type.hashCode();
- result = 31 * result + ( classifier != null ? classifier.hashCode() : 0 );
+ result = 31 * result + (classifier != null ? classifier.hashCode() : 0);
return result;
}
/**
* {@inheritDoc}
*/
- public String toString()
- {
+ public String toString() {
final StringBuffer sb = new StringBuffer();
- sb.append( "Artifact" );
- sb.append( "{" ).append( groupId );
- sb.append( ":" ).append( artifactId );
- sb.append( ":" ).append( getTimestampVersion() );
- if ( classifier != null )
- {
- sb.append( ":" ).append( classifier );
+ sb.append("Artifact");
+ sb.append("{").append(groupId);
+ sb.append(":").append(artifactId);
+ sb.append(":").append(getTimestampVersion());
+ if (classifier != null) {
+ sb.append(":").append(classifier);
}
- sb.append( ":" ).append( type );
- sb.append( '}' );
+ sb.append(":").append(type);
+ sb.append('}');
return sb.toString();
}
/**
* {@inheritDoc}
*/
- public int compareTo( Artifact that )
- {
- int rv = this.getGroupId().compareTo( that.getGroupId() );
- return rv == 0 ? getName().compareTo( that.getName() ) : rv;
+ public int compareTo(Artifact that) {
+ int rv = this.getGroupId().compareTo(that.getGroupId());
+ return rv == 0 ? getName().compareTo(that.getName()) : rv;
}
}
diff --git a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/ArtifactNotFoundException.java b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/ArtifactNotFoundException.java
index fee96d95..ff845428 100644
--- a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/ArtifactNotFoundException.java
+++ b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/ArtifactNotFoundException.java
@@ -21,9 +21,7 @@
*
* @since 1.0
*/
-public class ArtifactNotFoundException
- extends Exception
-{
+public class ArtifactNotFoundException extends Exception {
/**
* Ensure consistent serialization.
*
@@ -44,9 +42,8 @@ public class ArtifactNotFoundException
* @param artifact the artifact that was not found.
* @since 1.0
*/
- public ArtifactNotFoundException( Artifact artifact )
- {
- this( artifact.toString(), artifact, null );
+ public ArtifactNotFoundException(Artifact artifact) {
+ this(artifact.toString(), artifact, null);
}
/**
@@ -56,9 +53,8 @@ public ArtifactNotFoundException( Artifact artifact )
* @param cause the reason why it was not found (or null
if there is no specific reason)
* @since 1.0
*/
- public ArtifactNotFoundException( Artifact artifact, Throwable cause )
- {
- this( artifact.toString(), artifact, cause );
+ public ArtifactNotFoundException(Artifact artifact, Throwable cause) {
+ this(artifact.toString(), artifact, cause);
}
/**
@@ -68,9 +64,8 @@ public ArtifactNotFoundException( Artifact artifact, Throwable cause )
* @param artifact the artifact that was not found.
* @since 1.0
*/
- public ArtifactNotFoundException( String message, Artifact artifact )
- {
- this( message, artifact, null );
+ public ArtifactNotFoundException(String message, Artifact artifact) {
+ this(message, artifact, null);
}
/**
@@ -81,9 +76,8 @@ public ArtifactNotFoundException( String message, Artifact artifact )
* @param cause the reason why it was not found (or null
if there is no specific reason)
* @since 1.0
*/
- public ArtifactNotFoundException( String message, Artifact artifact, Throwable cause )
- {
- super( message, cause );
+ public ArtifactNotFoundException(String message, Artifact artifact, Throwable cause) {
+ super(message, cause);
this.artifact = artifact;
}
@@ -93,8 +87,7 @@ public ArtifactNotFoundException( String message, Artifact artifact, Throwable c
* @return the artifact that does not exist.
* @since 1.0
*/
- public Artifact getArtifact()
- {
+ public Artifact getArtifact() {
return artifact;
}
}
diff --git a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/ArtifactStore.java b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/ArtifactStore.java
index 613dba94..89d9b58c 100644
--- a/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/ArtifactStore.java
+++ b/mrm-api/src/main/java/org/codehaus/mojo/mrm/api/maven/ArtifactStore.java
@@ -16,22 +16,20 @@
package org.codehaus.mojo.mrm.api.maven;
-import org.apache.maven.archetype.catalog.ArchetypeCatalog;
-import org.apache.maven.artifact.repository.metadata.Metadata;
-
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Set;
+import org.apache.maven.archetype.catalog.ArchetypeCatalog;
+import org.apache.maven.artifact.repository.metadata.Metadata;
+
/**
* An artifact store holds Maven {@link Artifact}s and can provide {@link Metadata} about the artifacts that it holds.
*
* @since 1.0
*/
-public interface ArtifactStore
- extends Serializable
-{
+public interface ArtifactStore extends Serializable {
/**
*
@@ -64,7 +62,7 @@ public interface ArtifactStore
* one and only one additional segment.
* @since 1.0
*/
- Set
@@ -81,7 +79,7 @@ public interface ArtifactStore
* {@code groupId}.
* @since 1.0
*/
- Set
@@ -99,7 +97,7 @@ public interface ArtifactStore
* {@code groupId:artifactId}.
* @since 1.0
*/
- Set
* Starts a mock repository manager for manual testing.
*/
-@Mojo( name = "run", requiresProject = false, requiresDirectInvocation = true, threadSafe = true )
-public class RunMojo
- extends AbstractStartMojo
-{
+@Mojo(name = "run", requiresProject = false, requiresDirectInvocation = true, threadSafe = true)
+public class RunMojo extends AbstractStartMojo {
/**
* ServletPath for the settings.xml, so it can be downloaded.
*/
- @Parameter( property = "mrm.settingsServletPath", defaultValue = "settings-mrm.xml" )
+ @Parameter(property = "mrm.settingsServletPath", defaultValue = "settings-mrm.xml")
private String settingsServletPath;
/**
* {@inheritDoc}
*/
- public void doExecute()
- throws MojoExecutionException, MojoFailureException
- {
- if ( !session.getSettings().isInteractiveMode() )
- {
+ public void doExecute() throws MojoExecutionException, MojoFailureException {
+ if (!session.getSettings().isInteractiveMode()) {
throw new MojoExecutionException(
- "Cannot run a mock repository in batch mode (as there is no way to signal shutdown) "
- + "use mrm:start instead" );
+ "Cannot run a mock repository in batch mode (as there is no way to signal shutdown) "
+ + "use mrm:start instead");
}
- FileSystemServer mrm = createFileSystemServer( createArtifactStore() );
- getLog().info( "Starting Mock Repository Manager" );
+ FileSystemServer mrm = createFileSystemServer(createArtifactStore());
+ getLog().info("Starting Mock Repository Manager");
mrm.ensureStarted();
String url = mrm.getUrl();
- try
- {
- getLog().info( "Mock Repository Manager " + url + " is started." );
- if ( StringUtils.isNotEmpty( settingsServletPath ) )
- {
+ try {
+ getLog().info("Mock Repository Manager " + url + " is started.");
+ if (StringUtils.isNotEmpty(settingsServletPath)) {
String downloadUrl;
- try
- {
+ try {
downloadUrl = mrm.getRemoteUrl();
- }
- catch ( UnknownHostException e )
- {
+ } catch (UnknownHostException e) {
downloadUrl = mrm.getUrl();
}
- String settings = FileUtils.filename( settingsServletPath );
+ String settings = FileUtils.filename(settingsServletPath);
- getLog().info(
- "To share this repository manager, let users download " + downloadUrl + "/" + settingsServletPath );
- getLog().info( "Maven should be started as 'mvn --settings " + settings + " [phase|goal]'" );
+ getLog().info("To share this repository manager, let users download " + downloadUrl + "/"
+ + settingsServletPath);
+ getLog().info("Maven should be started as 'mvn --settings " + settings + " [phase|goal]'");
}
ConsoleScanner consoleScanner = new ConsoleScanner();
consoleScanner.start();
- getLog().info( "Hit ENTER on the console to stop the Mock Repository Manager and continue the build." );
+ getLog().info("Hit ENTER on the console to stop the Mock Repository Manager and continue the build.");
consoleScanner.waitForFinished();
- }
- catch ( InterruptedException e )
- {
+ } catch (InterruptedException e) {
// ignore
- }
- finally
- {
- getLog().info( "Stopping Mock Repository Manager " + url );
+ } finally {
+ getLog().info("Stopping Mock Repository Manager " + url);
mrm.finish();
- try
- {
+ try {
mrm.waitForFinished();
- getLog().info( "Mock Repository Manager " + url + " is stopped." );
- }
- catch ( InterruptedException e )
- {
+ getLog().info("Mock Repository Manager " + url + " is stopped.");
+ } catch (InterruptedException e) {
// ignore
}
}
@@ -109,9 +92,7 @@ public void doExecute()
* {@inheritDoc}
*/
@Override
- protected String getSettingsServletPath()
- {
+ protected String getSettingsServletPath() {
return settingsServletPath;
}
-
}
diff --git a/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/ServerLogger.java b/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/ServerLogger.java
index 8caa8543..5547cffe 100644
--- a/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/ServerLogger.java
+++ b/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/ServerLogger.java
@@ -25,72 +25,58 @@
*
* @author Slawomir Jaranowski
*/
-class ServerLogger extends Slf4jLog
-{
+class ServerLogger extends Slf4jLog {
private final boolean debugEnabled;
- ServerLogger( boolean debugEnabled )
- {
- this( ServerLogger.class.getName(), debugEnabled );
+ ServerLogger(boolean debugEnabled) {
+ this(ServerLogger.class.getName(), debugEnabled);
}
- ServerLogger( String name, boolean debugEnabled )
- {
- super( name );
+ ServerLogger(String name, boolean debugEnabled) {
+ super(name);
this.debugEnabled = debugEnabled;
}
@Override
- public void debug( String msg, Object... args )
- {
- if ( isDebugEnabled() )
- {
- super.debug( msg, args );
+ public void debug(String msg, Object... args) {
+ if (isDebugEnabled()) {
+ super.debug(msg, args);
}
}
@Override
- public void debug( String msg, long arg )
- {
- if ( isDebugEnabled() )
- {
- super.debug( msg, arg );
+ public void debug(String msg, long arg) {
+ if (isDebugEnabled()) {
+ super.debug(msg, arg);
}
}
@Override
- public void debug( Throwable thrown )
- {
- if ( isDebugEnabled() )
- {
- super.debug( thrown );
+ public void debug(Throwable thrown) {
+ if (isDebugEnabled()) {
+ super.debug(thrown);
}
}
@Override
- public void debug( String msg, Throwable thrown )
- {
- if ( isDebugEnabled() )
- {
- super.debug( msg, thrown );
+ public void debug(String msg, Throwable thrown) {
+ if (isDebugEnabled()) {
+ super.debug(msg, thrown);
}
}
@Override
- public boolean isDebugEnabled()
- {
+ public boolean isDebugEnabled() {
return debugEnabled;
}
@Override
- public void setDebugEnabled( boolean enabled )
- {
+ public void setDebugEnabled(boolean enabled) {
// do nothing
}
@Override
- protected Logger newLogger( String fullname )
- {
- return new ServerLogger( fullname, debugEnabled );
+ protected Logger newLogger(String fullname) {
+ return new ServerLogger(fullname, debugEnabled);
}
}
diff --git a/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/StartMojo.java b/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/StartMojo.java
index f708adaf..c585b315 100644
--- a/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/StartMojo.java
+++ b/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/StartMojo.java
@@ -16,6 +16,8 @@
* limitations under the License.
*/
+import java.util.Map;
+
import org.apache.commons.lang.StringUtils;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoExecutionException;
@@ -24,8 +26,6 @@
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
-import java.util.Map;
-
/**
* This goal is used in-situ on a Maven project to allow integration tests based on the Maven Invoker to use a custom
* null
if there is no specific reason)
* @since 1.0
*/
- public MetadataNotFoundException( String path, Throwable cause )
- {
- this( path, path, cause );
+ public MetadataNotFoundException(String path, Throwable cause) {
+ this(path, path, cause);
}
/**
@@ -81,9 +76,8 @@ public MetadataNotFoundException( String path, Throwable cause )
* @param cause the reason why it was not found (or null
if there is no specific reason)
* @since 1.0
*/
- public MetadataNotFoundException( String message, String path, Throwable cause )
- {
- super( message, cause );
+ public MetadataNotFoundException(String message, String path, Throwable cause) {
+ super(message, cause);
this.path = path;
}
@@ -93,8 +87,7 @@ public MetadataNotFoundException( String message, String path, Throwable cause )
* @return the path of the metadata that was not found.
* @since 1.0
*/
- public String getPath()
- {
+ public String getPath() {
return path;
}
}
diff --git a/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/ArtifactStoreFactory.java b/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/ArtifactStoreFactory.java
index b02079aa..98dc6fa5 100644
--- a/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/ArtifactStoreFactory.java
+++ b/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/ArtifactStoreFactory.java
@@ -24,8 +24,7 @@
* @see FactoryHelperRequired
* @since 1.0
*/
-public interface ArtifactStoreFactory
-{
+public interface ArtifactStoreFactory {
/**
* Creates a new {@link ArtifactStore} instance, note that implementations are free to create a singleton and always
* return that instance.
@@ -34,5 +33,4 @@ public interface ArtifactStoreFactory
* @since 1.0
*/
ArtifactStore newInstance();
-
}
diff --git a/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FactoryHelper.java b/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FactoryHelper.java
index ff6449a7..883599e1 100644
--- a/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FactoryHelper.java
+++ b/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FactoryHelper.java
@@ -16,6 +16,8 @@
package org.codehaus.mojo.mrm.plugin;
+import java.util.List;
+
import org.apache.maven.archetype.ArchetypeManager;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -23,16 +25,13 @@
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.plugin.logging.Log;
-import java.util.List;
-
/**
* Helper interface that exposes the Maven components that may be required.
*
* @see FactoryHelperRequired
* @since 1.0
*/
-public interface FactoryHelper
-{
+public interface FactoryHelper {
/**
* Returns the {@link RepositoryMetadataManager} provided by Maven.
*
@@ -91,11 +90,9 @@ public interface FactoryHelper
/**
* Returns the {@link ArchetypeManager}
- *
+ *
* @return The {@link ArchetypeManager}
* @since 1.0
*/
ArchetypeManager getArchetypeManager();
-
-
}
diff --git a/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FactoryHelperRequired.java b/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FactoryHelperRequired.java
index e35f4d8b..41213266 100644
--- a/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FactoryHelperRequired.java
+++ b/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FactoryHelperRequired.java
@@ -19,16 +19,15 @@
/**
* Marker interface to indicate that a {@link ArtifactStoreFactory} or {@link FileSystemFactory} should be provided with
* a {@link FactoryHelper} before use.
- *
+ *
* @since 1.0
*/
-public interface FactoryHelperRequired
-{
+public interface FactoryHelperRequired {
/**
* Provide the {@link FactoryHelper} instance.
- *
+ *
* @param factoryHelper the {@link FactoryHelper} instance.
* @since 1.0
*/
- void setFactoryHelper( FactoryHelper factoryHelper );
+ void setFactoryHelper(FactoryHelper factoryHelper);
}
diff --git a/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FileSystemFactory.java b/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FileSystemFactory.java
index b2fe378d..e5904ccf 100644
--- a/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FileSystemFactory.java
+++ b/mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FileSystemFactory.java
@@ -20,19 +20,17 @@
/**
* Something that produces new {@link FileSystem} instances.
- *
+ *
* @see FactoryHelperRequired
* @since 1.0
*/
-public interface FileSystemFactory
-{
+public interface FileSystemFactory {
/**
* Creates a new {@link FileSystem} instance, note that implementations are free to create a singleton and always
* return that instance.
- *
+ *
* @return the {@link FileSystem} instance.
* @since 1.0
*/
FileSystem newInstance();
-
}
diff --git a/mrm-api/src/test/java/org/codehaus/mojo/mrm/api/AbstractEntryTest.java b/mrm-api/src/test/java/org/codehaus/mojo/mrm/api/AbstractEntryTest.java
index 7be80002..2f6f9e3c 100644
--- a/mrm-api/src/test/java/org/codehaus/mojo/mrm/api/AbstractEntryTest.java
+++ b/mrm-api/src/test/java/org/codehaus/mojo/mrm/api/AbstractEntryTest.java
@@ -1,24 +1,21 @@
-package org.codehaus.mojo.mrm.api;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.junit.Test;
-
-public class AbstractEntryTest
-{
-
- // MMOCKRM-13
- @Test
- public void testPathForRootEntry()
- {
- FileSystem fileSystem = mock( FileSystem.class );
- DefaultDirectoryEntry entry = new DefaultDirectoryEntry( fileSystem, null, "/favicon.ico" );
-
- when( fileSystem.getRoot() ).thenReturn( entry );
-
- assertEquals( "/favicon.ico", entry.toPath() );
- }
-
-}
+package org.codehaus.mojo.mrm.api;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class AbstractEntryTest {
+
+ // MMOCKRM-13
+ @Test
+ public void testPathForRootEntry() {
+ FileSystem fileSystem = mock(FileSystem.class);
+ DefaultDirectoryEntry entry = new DefaultDirectoryEntry(fileSystem, null, "/favicon.ico");
+
+ when(fileSystem.getRoot()).thenReturn(entry);
+
+ assertEquals("/favicon.ico", entry.toPath());
+ }
+}
diff --git a/mrm-api/src/test/java/org/codehaus/mojo/mrm/api/maven/ArtifactTest.java b/mrm-api/src/test/java/org/codehaus/mojo/mrm/api/maven/ArtifactTest.java
index 6d6601da..0208cceb 100644
--- a/mrm-api/src/test/java/org/codehaus/mojo/mrm/api/maven/ArtifactTest.java
+++ b/mrm-api/src/test/java/org/codehaus/mojo/mrm/api/maven/ArtifactTest.java
@@ -15,16 +15,13 @@
*/
package org.codehaus.mojo.mrm.api.maven;
-import static org.junit.Assert.assertEquals;
-
import org.junit.Test;
-public class ArtifactTest
-{
+import static org.junit.Assert.assertEquals;
+
+public class ArtifactTest {
@Test
- public void testSmokes()
- throws Exception
- {
- assertEquals( new Artifact( "foo", "bar", "1.0", "jar" ), new Artifact( "foo", "bar", "1.0", null, "jar" ) );
+ public void testSmokes() throws Exception {
+ assertEquals(new Artifact("foo", "bar", "1.0", "jar"), new Artifact("foo", "bar", "1.0", null, "jar"));
}
}
diff --git a/mrm-maven-plugin/pom.xml b/mrm-maven-plugin/pom.xml
index 01a486c1..0ff7cdd4 100644
--- a/mrm-maven-plugin/pom.xml
+++ b/mrm-maven-plugin/pom.xml
@@ -1,5 +1,4 @@
-
-
true
if and only if the file system server is finished.
*
* @return true
if and only if the file system server is finished.
*/
- public boolean isFinished()
- {
- synchronized ( lock )
- {
+ public boolean isFinished() {
+ synchronized (lock) {
return finished;
}
}
@@ -218,10 +204,8 @@ public boolean isFinished()
*
* @return true
if and only if the file system server is started.
*/
- public boolean isStarted()
- {
- synchronized ( lock )
- {
+ public boolean isStarted() {
+ synchronized (lock) {
return finished;
}
}
@@ -229,10 +213,8 @@ public boolean isStarted()
/**
* Signal the file system server to shut down.
*/
- public void finish()
- {
- synchronized ( lock )
- {
+ public void finish() {
+ synchronized (lock) {
finishing = true;
lock.notifyAll();
}
@@ -243,13 +225,9 @@ public void finish()
*
* @throws InterruptedException if interrupted.
*/
- public void waitForFinished()
- throws InterruptedException
- {
- synchronized ( lock )
- {
- while ( !finished )
- {
+ public void waitForFinished() throws InterruptedException {
+ synchronized (lock) {
+ while (!finished) {
lock.wait();
}
}
@@ -260,10 +238,8 @@ public void waitForFinished()
*
* @return the port that the file system server is/will server on.
*/
- public int getPort()
- {
- synchronized ( lock )
- {
+ public int getPort() {
+ synchronized (lock) {
return started ? boundPort : requestedPort;
}
}
@@ -273,9 +249,8 @@ public int getPort()
*
* @return the root url that the file system server is/will server on.
*/
- public String getUrl()
- {
- return "http://localhost:" + getPort() + ( contextPath.equals( "/" ) ? "" : contextPath );
+ public String getUrl() {
+ return "http://localhost:" + getPort() + (contextPath.equals("/") ? "" : contextPath);
}
/**
@@ -284,81 +259,60 @@ public String getUrl()
* @return the scheme + raw IP address + port + contextPath
* @throws UnknownHostException if the local host name could not be resolved into an address.
*/
- public String getRemoteUrl() throws UnknownHostException
- {
+ public String getRemoteUrl() throws UnknownHostException {
return "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + getPort()
- + ( contextPath.equals( "/" ) ? "" : contextPath );
+ + (contextPath.equals("/") ? "" : contextPath);
}
/**
* The work to monitor and control the Jetty instance that hosts the file system.
*/
- private final class Worker
- implements Runnable
- {
+ private final class Worker implements Runnable {
/**
* {@inheritDoc}
*/
- public void run()
- {
- try
- {
- Logger serverLogger = new ServerLogger( debugServer );
- Log.setLog( serverLogger );
+ public void run() {
+ try {
+ Logger serverLogger = new ServerLogger(debugServer);
+ Log.setLog(serverLogger);
Log.initialized();
- Server server = new Server( requestedPort );
+ Server server = new Server(requestedPort);
- try
- {
+ try {
ServletContextHandler context = new ServletContextHandler();
- context.setContextPath( contextPath );
- context.addServlet( new ServletHolder( new FileSystemServlet( fileSystem, settingsServletPath ) ),
- "/*" );
- server.setHandler( context );
+ context.setContextPath(contextPath);
+ context.addServlet(new ServletHolder(new FileSystemServlet(fileSystem, settingsServletPath)), "/*");
+ server.setHandler(context);
server.start();
- synchronized ( lock )
- {
- boundPort = ( (ServerConnector) server.getConnectors()[0] ).getLocalPort();
+ synchronized (lock) {
+ boundPort = ((ServerConnector) server.getConnectors()[0]).getLocalPort();
starting = false;
started = true;
lock.notifyAll();
}
- }
- catch ( Exception e )
- {
- synchronized ( lock )
- {
+ } catch (Exception e) {
+ synchronized (lock) {
problem = e;
}
- serverLogger.warn( e );
+ serverLogger.warn(e);
throw e;
}
- synchronized ( lock )
- {
- while ( !finishing )
- {
- try
- {
- lock.wait( 500 );
- }
- catch ( InterruptedException e )
- {
+ synchronized (lock) {
+ while (!finishing) {
+ try {
+ lock.wait(500);
+ } catch (InterruptedException e) {
// ignore
}
}
}
server.stop();
server.join();
- }
- catch ( Exception e )
- {
+ } catch (Exception e) {
// ignore
- }
- finally
- {
- synchronized ( lock )
- {
+ } finally {
+ synchronized (lock) {
started = false;
starting = false;
finishing = false;
@@ -369,5 +323,4 @@ public void run()
}
}
}
-
}
diff --git a/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/ProxyRepo.java b/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/ProxyRepo.java
index 0def4252..53151d68 100644
--- a/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/ProxyRepo.java
+++ b/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/ProxyRepo.java
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-
import org.codehaus.mojo.mrm.api.maven.ArtifactStore;
import org.codehaus.mojo.mrm.maven.ProxyArtifactStore;
@@ -25,9 +24,7 @@
*
* @since 1.0
*/
-public class ProxyRepo
- implements ArtifactStoreFactory, FactoryHelperRequired
-{
+public class ProxyRepo implements ArtifactStoreFactory, FactoryHelperRequired {
/**
* Our factory helper.
@@ -37,33 +34,32 @@ public class ProxyRepo
/**
* {@inheritDoc}
*/
- public ArtifactStore newInstance()
- {
- if ( factoryHelper == null )
- {
- throw new IllegalStateException( "FactoryHelper has not been set" );
+ public ArtifactStore newInstance() {
+ if (factoryHelper == null) {
+ throw new IllegalStateException("FactoryHelper has not been set");
}
- return new ProxyArtifactStore( factoryHelper.getRepositoryMetadataManager(),
- factoryHelper.getRemoteArtifactRepositories(),
- factoryHelper.getRemotePluginRepositories(), factoryHelper.getLocalRepository(),
- factoryHelper.getArtifactFactory(), factoryHelper.getArtifactResolver(),
- factoryHelper.getArchetypeManager(),
- factoryHelper.getLog() );
+ return new ProxyArtifactStore(
+ factoryHelper.getRepositoryMetadataManager(),
+ factoryHelper.getRemoteArtifactRepositories(),
+ factoryHelper.getRemotePluginRepositories(),
+ factoryHelper.getLocalRepository(),
+ factoryHelper.getArtifactFactory(),
+ factoryHelper.getArtifactResolver(),
+ factoryHelper.getArchetypeManager(),
+ factoryHelper.getLog());
}
/**
* {@inheritDoc}
*/
- public void setFactoryHelper( FactoryHelper factoryHelper )
- {
+ public void setFactoryHelper(FactoryHelper factoryHelper) {
this.factoryHelper = factoryHelper;
}
/**
* {@inheritDoc}
*/
- public String toString()
- {
+ public String toString() {
return "Proxy (source: this Maven session)";
}
}
diff --git a/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/RunMojo.java b/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/RunMojo.java
index 0e2d1839..7a7235f5 100644
--- a/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/RunMojo.java
+++ b/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/RunMojo.java
@@ -33,73 +33,56 @@
* settings.xml
and still work behind a proxy.
@@ -34,40 +34,33 @@
*
* Starts a mock repository manager as part of a maven build for use by integration tests.
*/
-@Mojo( name = "start", defaultPhase = LifecyclePhase.PRE_INTEGRATION_TEST, requiresProject = false, threadSafe = true )
-public class StartMojo
- extends AbstractStartMojo
-{
+@Mojo(name = "start", defaultPhase = LifecyclePhase.PRE_INTEGRATION_TEST, requiresProject = false, threadSafe = true)
+public class StartMojo extends AbstractStartMojo {
/**
* The property to set the repository url to.
*/
- @Parameter( property = "mrm.propertyName", defaultValue = "mrm.repository.url" )
+ @Parameter(property = "mrm.propertyName", defaultValue = "mrm.repository.url")
private String propertyName;
/**
* {@inheritDoc}
*/
- @SuppressWarnings( { "rawtypes", "unchecked" } )
- public void doExecute()
- throws MojoExecutionException, MojoFailureException
- {
- FileSystemServer mrm = createFileSystemServer( createArtifactStore() );
- getLog().info( "Starting Mock Repository Manager" );
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ public void doExecute() throws MojoExecutionException, MojoFailureException {
+ FileSystemServer mrm = createFileSystemServer(createArtifactStore());
+ getLog().info("Starting Mock Repository Manager");
mrm.ensureStarted();
String url = mrm.getUrl();
- getLog().info( "Mock Repository Manager " + url + " is started." );
- if ( !StringUtils.isEmpty( propertyName ) )
- {
- getLog().info( "Setting property '" + propertyName + "' to '" + url + "'." );
- project.getProperties().setProperty( propertyName, url );
+ getLog().info("Mock Repository Manager " + url + " is started.");
+ if (!StringUtils.isEmpty(propertyName)) {
+ getLog().info("Setting property '" + propertyName + "' to '" + url + "'.");
+ project.getProperties().setProperty(propertyName, url);
}
- Map pluginContext = session.getPluginContext( pluginDescriptor, project );
- pluginContext.put( getFileSystemServerKey( getMojoExecution() ), mrm );
- }
-
- protected static String getFileSystemServerKey( MojoExecution mojoExecution )
- {
- return FileSystemServer.class.getName() + "@" + mojoExecution.getExecutionId();
+ Map pluginContext = session.getPluginContext(pluginDescriptor, project);
+ pluginContext.put(getFileSystemServerKey(getMojoExecution()), mrm);
}
+ protected static String getFileSystemServerKey(MojoExecution mojoExecution) {
+ return FileSystemServer.class.getName() + "@" + mojoExecution.getExecutionId();
+ }
}
diff --git a/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/StopMojo.java b/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/StopMojo.java
index 82a87aaa..28bb014a 100644
--- a/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/StopMojo.java
+++ b/mrm-maven-plugin/src/main/java/org/codehaus/mojo/mrm/plugin/StopMojo.java
@@ -16,13 +16,13 @@
* limitations under the License.
*/
+import java.util.Map;
+
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
-import java.util.Map;
-
/**
* This goal is used in-situ on a Maven project to allow integration tests based on the Maven Invoker to use a custom
* settings.xml
and still work behind a proxy.
@@ -32,38 +32,30 @@
* Stops the mock repository manager started by mrm:start
as part of a maven build for use
* by integration tests.
*/
-@Mojo( name = "stop", defaultPhase = LifecyclePhase.POST_INTEGRATION_TEST, requiresProject = false, threadSafe = true )
-public class StopMojo
- extends AbstractMRMMojo
-{
+@Mojo(name = "stop", defaultPhase = LifecyclePhase.POST_INTEGRATION_TEST, requiresProject = false, threadSafe = true)
+public class StopMojo extends AbstractMRMMojo {
/**
* {@inheritDoc}
*/
- @SuppressWarnings( "rawtypes" )
- public void doExecute()
- throws MojoExecutionException, MojoFailureException
- {
- Map pluginContext = session.getPluginContext( pluginDescriptor, project );
+ @SuppressWarnings("rawtypes")
+ public void doExecute() throws MojoExecutionException, MojoFailureException {
+ Map pluginContext = session.getPluginContext(pluginDescriptor, project);
FileSystemServer mrm =
- (FileSystemServer) pluginContext.get( StartMojo.getFileSystemServerKey( getMojoExecution() ) );
+ (FileSystemServer) pluginContext.get(StartMojo.getFileSystemServerKey(getMojoExecution()));
- if ( mrm == null )
- {
- getLog().info( "Mock Repository Manager was not started" );
+ if (mrm == null) {
+ getLog().info("Mock Repository Manager was not started");
return;
}
String url = mrm.getUrl();
- getLog().info( "Stopping Mock Repository Manager on " + url );
+ getLog().info("Stopping Mock Repository Manager on " + url);
mrm.finish();
- try
- {
+ try {
mrm.waitForFinished();
- getLog().info( "Mock Repository Manager " + url + " is stopped." );
- pluginContext.remove( FileSystemServer.class.getName() );
- }
- catch ( InterruptedException e )
- {
- throw new MojoExecutionException( e.getMessage(), e );
+ getLog().info("Mock Repository Manager " + url + " is stopped.");
+ pluginContext.remove(FileSystemServer.class.getName());
+ } catch (InterruptedException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
}
}
}
diff --git a/mrm-maven-plugin/src/test/java/org/codehaus/mojo/mrm/maven/ProxyArtifactStoreTest.java b/mrm-maven-plugin/src/test/java/org/codehaus/mojo/mrm/maven/ProxyArtifactStoreTest.java
index 9d6708aa..ac0836f2 100644
--- a/mrm-maven-plugin/src/test/java/org/codehaus/mojo/mrm/maven/ProxyArtifactStoreTest.java
+++ b/mrm-maven-plugin/src/test/java/org/codehaus/mojo/mrm/maven/ProxyArtifactStoreTest.java
@@ -1,91 +1,89 @@
-package org.codehaus.mojo.mrm.maven;
-
-/*
- * 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.Collections;
-
-import org.apache.maven.archetype.ArchetypeManager;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
-import org.codehaus.mojo.mrm.api.maven.Artifact;
-import org.codehaus.mojo.mrm.api.maven.ArtifactNotFoundException;
-import org.junit.Test;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.isNull;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-
-public class ProxyArtifactStoreTest
-{
-
- @Test( expected = ArtifactNotFoundException.class )
- public void verifyArtifactNotFoundExceptionOnGet()
- throws Exception
- {
- ArtifactFactory artifactFactory = mock( ArtifactFactory.class );
- ArtifactResolver artifactResolver = mock( ArtifactResolver.class );
- ProxyArtifactStore store =
- new ProxyArtifactStore( null, Collections.emptyList(),
- Collections.emptyList(), null, artifactFactory,
- artifactResolver, null, null );
-
- doThrow( org.apache.maven.artifact.resolver.ArtifactNotFoundException.class )
- .when( artifactResolver )
- .resolve( isNull(), eq( Collections.emptyList() ), any() );
-
- Artifact artifact = new Artifact( "localhost", "test", "1.0-SNAPSHOT", "pom" );
- store.get( artifact );
- }
-
- @Test( expected = RuntimeException.class )
- public void verifyArtifactResolutionExceptionOnGet()
- throws Exception
- {
- ArtifactFactory artifactFactory = mock( ArtifactFactory.class );
- ArtifactResolver artifactResolver = mock( ArtifactResolver.class );
- ProxyArtifactStore store =
- new ProxyArtifactStore( null, Collections.emptyList(),
- Collections.emptyList(), null, artifactFactory,
- artifactResolver, null, null );
-
- doThrow( RuntimeException.class )
- .when( artifactResolver )
- .resolve( isNull(), eq( Collections.emptyList() ), any() );
-
- Artifact artifact = new Artifact( "localhost", "test", "1.0-SNAPSHOT", "pom" );
- store.get( artifact );
- }
-
- @Test( expected = RuntimeException.class )
- public void verifyArchetypeCatalogNotFoundException()
- throws Exception
- {
- ArchetypeManager archetypeManager = mock( ArchetypeManager.class );
- ProxyArtifactStore store =
- new ProxyArtifactStore( null, Collections.emptyList(),
- Collections.emptyList(), null, null, null, archetypeManager,
- null );
- doThrow( RuntimeException.class ).when( archetypeManager ).getDefaultLocalCatalog();
- store.getArchetypeCatalog();
- }
-
-}
+package org.codehaus.mojo.mrm.maven;
+
+/*
+ * 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.Collections;
+
+import org.apache.maven.archetype.ArchetypeManager;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.codehaus.mojo.mrm.api.maven.Artifact;
+import org.codehaus.mojo.mrm.api.maven.ArtifactNotFoundException;
+import org.junit.Test;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+
+public class ProxyArtifactStoreTest {
+
+ @Test(expected = ArtifactNotFoundException.class)
+ public void verifyArtifactNotFoundExceptionOnGet() throws Exception {
+ ArtifactFactory artifactFactory = mock(ArtifactFactory.class);
+ ArtifactResolver artifactResolver = mock(ArtifactResolver.class);
+ ProxyArtifactStore store = new ProxyArtifactStore(
+ null,
+ Collections.emptyList(),
+ Collections.emptyList(),
+ null,
+ artifactFactory,
+ artifactResolver,
+ null,
+ null);
+
+ doThrow(org.apache.maven.artifact.resolver.ArtifactNotFoundException.class)
+ .when(artifactResolver)
+ .resolve(isNull(), eq(Collections.emptyList()), any());
+
+ Artifact artifact = new Artifact("localhost", "test", "1.0-SNAPSHOT", "pom");
+ store.get(artifact);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void verifyArtifactResolutionExceptionOnGet() throws Exception {
+ ArtifactFactory artifactFactory = mock(ArtifactFactory.class);
+ ArtifactResolver artifactResolver = mock(ArtifactResolver.class);
+ ProxyArtifactStore store = new ProxyArtifactStore(
+ null,
+ Collections.emptyList(),
+ Collections.emptyList(),
+ null,
+ artifactFactory,
+ artifactResolver,
+ null,
+ null);
+
+ doThrow(RuntimeException.class).when(artifactResolver).resolve(isNull(), eq(Collections.emptyList()), any());
+
+ Artifact artifact = new Artifact("localhost", "test", "1.0-SNAPSHOT", "pom");
+ store.get(artifact);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void verifyArchetypeCatalogNotFoundException() throws Exception {
+ ArchetypeManager archetypeManager = mock(ArchetypeManager.class);
+ ProxyArtifactStore store = new ProxyArtifactStore(
+ null, Collections.emptyList(), Collections.emptyList(), null, null, null, archetypeManager, null);
+ doThrow(RuntimeException.class).when(archetypeManager).getDefaultLocalCatalog();
+ store.getArchetypeCatalog();
+ }
+}
diff --git a/mrm-servlet/pom.xml b/mrm-servlet/pom.xml
index 4e540c67..c993b21f 100644
--- a/mrm-servlet/pom.xml
+++ b/mrm-servlet/pom.xml
@@ -1,5 +1,4 @@
-
-
true
if the file system is to be read-only
* @since 1.0
*/
- public DiskFileSystem( File root, boolean readOnly )
- {
+ public DiskFileSystem(File root, boolean readOnly) {
this.root = root;
this.readOnly = readOnly;
}
@@ -70,33 +67,26 @@ public DiskFileSystem( File root, boolean readOnly )
* @param root the root of the file system.
* @since 1.0
*/
- public DiskFileSystem( File root )
- {
- this( root, true );
+ public DiskFileSystem(File root) {
+ this(root, true);
}
/**
* {@inheritDoc}
*/
- public Entry[] listEntries( DirectoryEntry directory )
- {
- File file = toFile( directory );
- if ( !file.isDirectory() )
- {
+ public Entry[] listEntries(DirectoryEntry directory) {
+ File file = toFile(directory);
+ if (!file.isDirectory()) {
return null;
}
File[] files = file.listFiles();
Entry[] result = new Entry[files.length];
- for ( int i = 0; i < files.length; i++ )
- {
- if ( files[i].isFile() )
- {
- result[i] = new DiskFileEntry( this, directory, files[i] );
- }
- else
- {
- result[i] = new DefaultDirectoryEntry( this, directory, files[i].getName() );
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isFile()) {
+ result[i] = new DiskFileEntry(this, directory, files[i]);
+ } else {
+ result[i] = new DefaultDirectoryEntry(this, directory, files[i].getName());
}
}
return result;
@@ -105,10 +95,8 @@ public Entry[] listEntries( DirectoryEntry directory )
/**
* {@inheritDoc}
*/
- public long getLastModified( DirectoryEntry entry )
- throws IOException
- {
- return toFile( entry ).lastModified();
+ public long getLastModified(DirectoryEntry entry) throws IOException {
+ return toFile(entry).lastModified();
}
/**
@@ -118,30 +106,23 @@ public long getLastModified( DirectoryEntry entry )
* @return the corresponding file.
* @since 1.0
*/
- private File toFile( Entry entry )
- {
+ private File toFile(Entry entry) {
Stacknull
).
* @since 1.0
*/
- private synchronized Listmaven-plugin-plugin
and that contains
* configuration of the goalPrefix
, update the supplied plugin with that prefix.
@@ -612,21 +489,16 @@ public synchronized long getArchetypeCatalogLastModified()
* @return true
if the prefix has been set.
* @since 1.0
*/
- private boolean setPluginGoalPrefixFromConfiguration( Plugin plugin,
- List