Skip to content
Commits on Source (4)
language: java
jdk:
- openjdk7
- oraclejdk8
# No need for preliminary install step.
install: true
#
# Run all integration tests.
script:
- "mvn --show-version --errors --batch-mode clean verify"
#
cache:
directories:
- $HOME/.m2
branches:
except:
- gh-pages
notifications:
email:
- kama@soebes.de
Plexus-IO
=========
[![Build Status](https://travis-ci.org/codehaus-plexus/plexus-io.svg?branch=master)](https://travis-ci.org/codehaus-plexus/plexus-io)
[![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.plexus/plexus-io.svg?label=Maven%20Central)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.codehaus.plexus%22%20a%3A%plexus-io%22)
The current master is now at https://github.com/codehaus-plexus/plexus-io
For publishing [the site](https://codehaus-plexus.github.io/plexus-io/) do the following:
```
mvn -Preporting verify site site:stage scm-publish:publish-scm
```
## Release Notes
You can find details about the different releases in the
[Release Notes](https://github.com/codehaus-plexus/plexus-io/blob/master/ReleaseNotes.md).
* [Release 3.0.1](https://github.com/codehaus-plexus/plexus-io/blob/master/ReleaseNotes.md#plexus-io-301).
* [Release 3.0.0](https://github.com/codehaus-plexus/plexus-io/blob/master/ReleaseNotes.md#plexus-io-300).
Plexus-IO Release Notes
========================================================================
Plexus IO 3.0.1
---------------
Plexus IO 3.0.1 requires Java 7.
### Tasks
* [Issue #9][issue-9], [Issue #10][issue-10] - Updated dependencies:
`plexus-utils` to 3.1.0 and `commons-io` to 2.6
Plexus IO 3.0.0
---------------
Plexus IO 3.0.0 requires Java 7 and introduces backward incompatible changes:
* `Java7FileAttributes` is renamed to `FileAttributes`, replacing
the old `FileAttributes` implementation
* `Java7AttributeUtils` is renamed to `AttributeUtils`
* `PlexusIoResourceAttributeUtils#getFileAttributesByPath( File, boolean, boolean )`
is deleted
### Improvements
* [Pull Request #5][pr-5] - The required Java version is upgraded to 7.
Classes that use native tools like `ls` are removed and the pure Java
implementations are used instead.
### Tasks
* [Issue #8][issue-8] - Update of `plexus-utils` to 3.0.24 and
`commons-io` to 2.5
Plexus IO 2.7.1
---------------
### Improvements
* [Pull Request #3][pr-3] - Introduce new constant to indicate uknown
octal mode for resources - `PlexusIoResourceAttributes.UNKNOWN_OCTAL_MODE`
### Bugs
* [Issue #2][issue-2] - JAR entry not found when JAR is updated inline and
cached by URLConnection
Plexus IO 2.7
---------------
### Improvements
* Added TIME_STYLE=long-iso to ls screen scrape
* [Pull Request #1][pr-1] - Add concurrent access flag
to the PlexusIoProxyResourceCollection -
`PlexusIoResourceCollection#isConcurrentAccessSupported()`
Plexus IO 2.6.1
---------------
### Improvement
* Performance improvement affecting mac/linux users
with lots of small files in large archives.
Plexus IO 2.5
-------------
* Proper support for closeable on zip archives.
* Removed zip supporting PlexusIoZipFileResourceCollection; which now exists in plexus-archiver. (Drop in replacement,
just change/add jar file).
Plexus IO 2.4.1
---------------
### Bugs
* PLXCOMP-279 - PlexusIoProxyResourceCollection does not provide Closeable iterator
* Fixed PLXCOMP-280 - SimpleResourceAttributes has incorrect value for
default file mode
Plexus IO 2.4
-------------
### Improvements
* PLXCOMP-274 - Simplify use of proxies
* PLXCOMP-275 - Avoid leaky abstractions
* PLXCOMP-276 - Reduce number of ways to create a PlexusIoResource
Plexus IO 2.3.5
---------------
### Bugs
* PLXCOMP-278 - Symlink attribute was not preserved through merged/overridden attributes
Plexus IO 2.3.4
---------------
### Bugs
* PLXCOMP-270 - Escaping algoritghm leaks through to system classloader
* PLXCOMP-272 - Overriding dirmode/filemode breaks symlinks
Plexus IO 2.3.3
---------------
### Bugs
* PLXCOMP-267 - StreamTransformers are consistently applied to all collections
Plexus IO 2.3.2
---------------
### Bugs
* PLXCOMP-265 - Locale in shell influences "ls" parsing for screenscraper
Plexus IO 2.3.1
---------------
### Bugs
* PLXCOMP-264 - Thread safety issue in streamconsumer
Plexus IO 2.3
-------------
### New Features
* PLXCOMP-261 - Make plexus io collections support on-the-fly filtering
### Improvements
* PLXCOMP-260 - Make plexus io collections iterable
Plexus IO 2.2
-------------
### Bugs
* PLXCOMP-251 - Date parsing in "ls" screenscraping has locale dependencies
* PLXCOMP-254 - Fix File.separatorChar normalization when prefixes are used
Plexus IO 2.1.4
---------------
### Improvements
* PLXCOMP-250 - Upgrade maven-enforcer-plugin to 1.3.1
### Bugs
* PLXCOMP-107 - Fail to unzip archive, which contains file with name
'How_can_I_annotate_a_part_in_the_AAM%3F.Help'
Plexus IO 2.1.3
---------------
### Bugs
* PLXCOMP-247 - Bug with windows AND java5
Plexus IO 2.1.2
---------------
### Bugs
* PLXCOMP-244 - Don't try to set attributes of symbolic links
* PLXCOMP-245 - Archives created on windows get zero permissions,
creates malformed permissions on linux
Plexus IO 2.1.1
---------------
### Bugs
* PLXCOMP-243 - Restore JDK1.5 compatibility
Plexus IO 2.1
-------------
### Improvements
* PLXCOMP-64 - add symlink support to tar unarchiver
* PLXCOMP-117 - add symbolic links managment
### Bugs
* PLXCOMP-113 - zip unarchiver doesn't support symlinks (and trivial to fix)
* PLXCOMP-241 - ResourcesTest.compare test failure
* PLXCOMP-248 - Use java7 setAttributes and ignore useJvmChmod flag when applicable
Plexus IO 2.0.12
----------------
### Bugs
* PLXCOMP-249 - Add support for java7 chmod
[issue-2]: https://github.com/codehaus-plexus/plexus-io/issues/2
[issue-8]: https://github.com/codehaus-plexus/plexus-io/issues/8
[issue-9]: https://github.com/codehaus-plexus/plexus-io/issues/9
[issue-10]: https://github.com/codehaus-plexus/plexus-io/issues/10
[pr-1]: https://github.com/codehaus-plexus/plexus-io/pull/1
[pr-3]: https://github.com/codehaus-plexus/plexus-io/pull/3
[pr-5]: https://github.com/codehaus-plexus/plexus-io/pull/5
plexus-io (3.1.0-1) unstable; urgency=medium
* Team upload.
* New upstream release
* Standards-Version updated to 4.2.1
-- Emmanuel Bourg <ebourg@apache.org> Mon, 19 Nov 2018 13:05:07 +0100
plexus-io (3.0.1-1) unstable; urgency=medium
* Team upload.
......
......@@ -16,7 +16,7 @@ Build-Depends:
libplexus-container-default1.5-java,
libplexus-utils2-java,
maven-debian-helper (>= 2.2)
Standards-Version: 4.1.5
Standards-Version: 4.2.1
Vcs-Git: https://salsa.debian.org/java-team/plexus-io.git
Vcs-Browser: https://salsa.debian.org/java-team/plexus-io
Homepage: https://github.com/codehaus-plexus/plexus-io
......
......@@ -2,13 +2,13 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>plexus</artifactId>
<groupId>org.codehaus.plexus</groupId>
<version>5.0</version>
<artifactId>plexus</artifactId>
<version>5.1</version>
</parent>
<artifactId>plexus-io</artifactId>
<version>3.0.1</version>
<version>3.1.0</version>
<name>Plexus IO Components</name>
......@@ -16,7 +16,7 @@
<connection>scm:git:git@github.com:codehaus-plexus/plexus-io.git</connection>
<developerConnection>scm:git:git@github.com:codehaus-plexus/plexus-io.git</developerConnection>
<url>http://github.com/codehaus-plexus/plexus-io</url>
<tag>plexus-io-3.0.1</tag>
<tag>plexus-io-3.1.0</tag>
</scm>
<issueManagement>
<system>jira</system>
......
package org.codehaus.plexus.components.io.filemappers;
/*
* Licensed 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 javax.annotation.Nonnull;
/**
* A file mapper, which maps by adding a suffix to the filename.
* If the filename contains dot, the suffix will be added before.
* Example : {@code directory/archive.tar.gz => directory/archivesuffix.tar.gz}
*/
public class SuffixFileMapper extends AbstractFileMapper
{
/**
* The suffix mappers role-hint: "suffix".
*/
public static final String ROLE_HINT = "suffix";
private String suffix;
/**
* Returns the suffix to add.
*/
public String getSuffix()
{
return suffix;
}
/**
* Sets the suffix to add.
*/
public void setSuffix( String suffix )
{
if ( suffix == null )
{
throw new IllegalArgumentException( "The suffix is null." );
}
this.suffix = suffix;
}
@Nonnull
public String getMappedFileName( @Nonnull String pName)
{
final String name = super.getMappedFileName( pName );
if ( suffix == null )
{
throw new IllegalStateException( "The suffix has not been set." );
}
final int dirSep = Math.max( name.lastIndexOf( '/' ), name.lastIndexOf( '\\' ) );
String filename = dirSep > 0 ? name.substring( dirSep + 1 ) : name;
String dirname = dirSep > 0 ? name.substring( 0, dirSep + 1 ) : "";
if ( filename.contains( "." ) )
{
String beforeExtension = filename.substring( 0, filename.indexOf( '.' ) );
String afterExtension = filename.substring( filename.indexOf( '.' ) + 1 ) ;
return dirname + beforeExtension + suffix + "." + afterExtension;
}
return name + suffix;
}
}
\ No newline at end of file
......@@ -42,6 +42,13 @@
<instantiation-strategy>per-lookup</instantiation-strategy>
<configuration/>
</component>
<component>
<role>org.codehaus.plexus.components.io.filemappers.FileMapper</role>
<role-hint>suffix</role-hint>
<implementation>org.codehaus.plexus.components.io.filemappers.SuffixFileMapper</implementation>
<instantiation-strategy>per-lookup</instantiation-strategy>
<configuration/>
</component>
<component>
<role>org.codehaus.plexus.components.io.filemappers.FileMapper</role>
<role-hint>regexp</role-hint>
......
......@@ -7,14 +7,14 @@ File Mappers
A file mapper is a plexus component, which allows to convert file
names. File mappers are used when creating files. For example,
the {{{http://mojo.codehaus.org/xml-maven-plugin}XML Maven Plugin}}
the {{{https://www.mojohaus.org/xml-maven-plugin}XML Maven Plugin}}
allows to specify a file mapper when creating files by XSLT
transformation.
File mappers are implementing the interface
{{{./apidocs/org/codehaus/plexus/components/io/filemappers/FileMapper.html}FileMapper}}.
The idea of file mappers is borrowed from the
{{{http://ant.apache.org/manual/CoreTypes/mapper.html}Ant FileMapper}},
{{{https://ant.apache.org/manual/Types/mapper.html}Ant FileMapper}},
which serves the same purpose within Ant.
Available file mappers are
......@@ -31,6 +31,9 @@ File Mappers
* The {{{#Merging File Mapper}Merging File Mapper}}; its role hint is
"merge".
* The {{{#Suffix File Mapper}Suffix File Mapper}}; its role hint is
"suffix".
* {Identity Mapper}
The {{{./apidocs/org/codehaus/plexus/components/io/filemappers/IdentityMapper.html}identity mapper}}
......@@ -94,3 +97,26 @@ File Mappers
-----------------------------------------------------------------------------
The merging file mapper uses the role hint "merge".
* {Suffix File Mapper}
The {{{./apidocs/org/codehaus/plexus/components/io/filemappers/SuffixFileMapper.html}suffix
file mapper}} adds the given suffix to the filename. The suffix will be added before the file
extension. Examples :
-----------------------------------------------------------------------------
theFile.txt => theFileNiceSuffix.txt
dir/file.java => dir/fileNiceSuffix.java
fileWithoutExtension => fileWithoutExtensionNiceSuffix
dir/archive.tar.gz => dir/archiveNiceSuffix.tar.gz
-----------------------------------------------------------------------------
It would be configured as follows:
-----------------------------------------------------------------------------
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.SuffixFileMapper">
<suffix>NiceSuffix</suffix>
</fileMapper>
-----------------------------------------------------------------------------
The suffix file mapper uses the role hint "suffix".
......@@ -17,6 +17,7 @@
*/
import java.lang.reflect.UndeclaredThrowableException;
import java.util.Arrays;
import org.codehaus.plexus.PlexusTestCase;
......@@ -165,6 +166,23 @@ public void testPrefixMapper() throws Exception
testFileMapper( mapper, SAMPLES, results );
}
public void testSuffixMapper() throws Exception
{
final String suffix = "suffix";
String[] samples = Arrays.copyOf( SAMPLES, SAMPLES.length + 2 );
samples[samples.length - 2] = "archive.tar.gz";
samples[samples.length - 1] = "directory/archive.tar.gz";
String[] results = new String[] { null, null, "asuffix", "xyzsuffix.gif", "b/asuffix", "b/xyzsuffix.gif",
"b\\asuffix", "b\\xyzsuffix.gif", "c.c/asuffix", "c.c/xyzsuffix.gif", "c.c\\asuffix", "c.c\\xyzsuffix.gif",
"archivesuffix.tar.gz", "directory/archivesuffix.tar.gz" };
SuffixFileMapper mapper = new SuffixFileMapper();
mapper.setSuffix( suffix );
testFileMapper( mapper, samples, results );
mapper = (SuffixFileMapper) lookup( FileMapper.ROLE, SuffixFileMapper.ROLE_HINT );
mapper.setSuffix( suffix );
testFileMapper( mapper, samples, results );
}
private RegExpFileMapper configure( RegExpFileMapper pMapper, String pPattern, String pReplacement )
{
pMapper.setPattern( pPattern );
......