Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 0 additions & 122 deletions src/site/apt/filemappers.apt

This file was deleted.

63 changes: 0 additions & 63 deletions src/site/apt/fileselectors.apt

This file was deleted.

28 changes: 0 additions & 28 deletions src/site/apt/index.apt

This file was deleted.

84 changes: 84 additions & 0 deletions src/site/markdown/filemappers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 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 [XML Maven Plugin](https://www.mojohaus.org/xml-maven-plugin) allows to specify a file mapper when creating files by XSLT transformation.

File mappers are implementing the interface [FileMapper](./apidocs/org/codehaus/plexus/components/io/filemappers/FileMapper.html). The idea of file mappers is borrowed from the [Ant FileMapper](https://ant.apache.org/manual/Types/mapper.html), which serves the same purpose within Ant.

Available file mappers are

- The [Identity Mapper](#Identity_Mapper); it uses the role hints "default", or "identity".
- The [File Extension Mapper](#File_Extension_Mapper); its role hint is "fileExtension".
- The [Flattening File Mapper](#Flattening_File_Mapper) with the role hint of "flatten".
- The [Merging File Mapper](#Merging_File_Mapper); its role hint is "merge".
- The [Suffix File Mapper](#Suffix_File_Mapper); its role hint is "suffix".

## <a id="Identity_Mapper"></a>Identity Mapper

The [identity mapper](./apidocs/org/codehaus/plexus/components/io/filemappers/IdentityMapper.html) maps any file name to itself. This may be handy, where you want to avoid the value null for file mappers. The identity takes no configuration parameters.

For example, to use the identity mapper within the XML Maven Plugins `transform` goal, you would use the following configuration snipped:

```
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.IdentityMapper"/>
```

The identity mapper uses the role hints "identity", or "default".

## <a id="File_Extension_Mapper"></a>File Extension Mapper

The [file extension mapper](./apidocs/org/codehaus/plexus/components/io/filemappers/FileExtensionMapper.html) changes the extension of the created files. For example, if you would use the XML Maven Plugin to convert Docbook into FOP or PDF files, then you would want the generated files to have the extension ".fo", or ".pdf".

A configuration snippet for using the identity mapper within the XML Maven Plugins `transform` goal would look like this:

```
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.pdf</targetExtension>
</fileMapper>
```

The file extension mapper uses the role hints "fileExtension".

## <a id="Flattening_File_Mapper"></a>Flattening File Mapper

The [flattening file mapper](./apidocs/org/codehaus/plexus/components/io/filemappers/FlattenFileMapper.html) is used to flatten a directory structure: It removes all directory components. For example, it would convert the name `META-INF/MANIFEST.MF` to `MANIFEST.MF`.

The flattening file mapper takes no configuration parameters. Consequently, a typical configuration snippet would look like this:

```
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FlattenFileMapper"/>
```

The flattening file mapper uses the role hint "flatten".

## <a id="Merging_File_Mapper"></a>Merging File Mapper

The [merging file mapper](./apidocs/org/codehaus/plexus/components/io/filemappers/MergeFileMapper.html) merges all possible file names into one file name. In other words, it performs a constant mapping. For example, a merging file mapper, which maps all possible file names to `theOneAndOnlyFile` would be configured as follows:

```
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.MergeFileMapper">
<targetName>theOneAndOnlyFile</targetName>
</fileMapper>
```

The merging file mapper uses the role hint "merge".

## <a id="Suffix_File_Mapper"></a>Suffix File Mapper

The [suffix file mapper](./apidocs/org/codehaus/plexus/components/io/filemappers/SuffixFileMapper.html) 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".
46 changes: 46 additions & 0 deletions src/site/markdown/fileselectors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# File Selectors

A file selector is a plexus component, which allows to select certain files out of a given set. For example, the [Plexus Archiver](http://plexus.codehaus.org/plexus-archiver) uses file selectors to select the files being archived out of a base directory. Its counterpart, the Plexus Unarchiver allows to restrict the files to unarchive.

File mappers are implementing the interface [FileSelector](./apidocs/org/codehaus/plexus/components/io/fileselectors/FileSelector.html).

Available file selectors are

- The [All Files Selector](#All_Files_Selector); it uses the role hints "default", or "all".
- The [Standard File Selector](#Standard_File_Selector); its role hint is "standard".

## <a id="All_Files_Selector"></a>All Files Selector

The [selector for all files](./apidocs/org/codehaus/plexus/components/io/fileselectors/AllFilesFileSelector.html) doesn't exclude any files. It is mainly useful when you want to avoid the value null for a file selector.

A configuration snippet for using the selector for all files would look like this:

```
<fileSelector implementation="org.codehaus.plexus.components.io.fileselectors.AllFilesFileSelector"/>
```

The selector for all files uses the role hints "all", or "default".

## <a id="Standard_File_Selector"></a>Standard File Selector

The [standard file selector](./apidocs/org/codehaus/plexus/components/io/fileselectors/IncludeExcludeFileSelector) selects files based on include/exclude patterns.

A configuration snippet for using the standard file selector would look like this:

```
<fileSelector implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<includes>
<include>**/*.gif</include>
<include>**/*.png</include>
<include>**/*.jpg</include>
<include>**/*.jpeg</include>
</includes>
<excludes>
<exclude>bar/</exclude>
</excludes>
<useDefaultExcludes>true</useDefaultExcludes>
<caseSensitive>false</caseSensitive>
</fileSelector>
```

This would include all image files, with the exception of those in the directory `bar`. The default excludes (for example `CVS/`) would apply and file names would be treated case insensitive.
10 changes: 10 additions & 0 deletions src/site/markdown/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Plexus IO

Plexus IO is a set of plexus components, which are designed for use in I/O operations. These I/O operations are doing nothing spectacular. For example, [Commons IO](http://jakarta.apache.org/commons/io) is a much more powerful library in the same area. However, the implementation as a plexus component allows reuse in Maven.

The following component groups are currently available:

- [File Mappers](./filemappers.html)
- [File Selectors](./fileselectors.html)

Plexus IO components are typically very simple components, who could very well live as part of the [Plexus Utils](http://plexus.codehaus.org/plexus-utils). They do not, because Plexus Utils is a dependency of the [Plexus Component API](http://plexus.codehaus.org/plexus-containers/plexus-container-default), which is in turn a dependency of the Plexus IO test suite (of course, a Plexus container is required to test components, even if they are POJO's). In other words, Plexus Utils cannot contain components, because that would introduce a circular dependency.
Loading