Skip to content

Commit 8225985

Browse files
author
bentmann
committedApr 11, 2008
o Added svn:eol-style=native
1 parent 308acdc commit 8225985

26 files changed

+1926
-1926
lines changed
 

‎NOTICE.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
This product includes software developed by
2-
The Apache Software Foundation (http://www.apache.org/).
1+
This product includes software developed by
2+
The Apache Software Foundation (http://www.apache.org/).
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
1-
package org.codehaus.plexus.components.io.filemappers;
2-
3-
/**
4-
* An implementation of {@link FileMapper}, which changes the files extension.
5-
*/
6-
public class FileExtensionMapper extends IdentityMapper
7-
{
8-
/**
9-
* The file extension mappers role-hint: "fileExtension".
10-
*/
11-
public static final String ROLE_HINT = "fileExtension";
12-
13-
private String targetExtension;
14-
15-
/**
16-
* Sets the target files extension.
17-
*
18-
* @throws IllegalArgumentException
19-
* The target extension is null or empty.
20-
*/
21-
public void setTargetExtension( String pTargetExtension )
22-
{
23-
if ( pTargetExtension == null )
24-
{
25-
throw new IllegalArgumentException( "The target extension is null." );
26-
}
27-
if ( pTargetExtension.length() == 0 )
28-
{
29-
throw new IllegalArgumentException( "The target extension is empty." );
30-
}
31-
if ( pTargetExtension.charAt( 0 ) == '.' )
32-
{
33-
targetExtension = pTargetExtension;
34-
}
35-
else
36-
{
37-
targetExtension = '.' + pTargetExtension;
38-
}
39-
}
40-
41-
/**
42-
* Returns the target files extension.
43-
*/
44-
public String getTargetExtension()
45-
{
46-
return targetExtension;
47-
}
48-
49-
public String getMappedFileName( String pName )
50-
{
51-
final String ext = getTargetExtension();
52-
if ( ext == null )
53-
{
54-
throw new IllegalStateException( "The target extension has not been set." );
55-
}
56-
final String name = super.getMappedFileName( pName ); // Check arguments
57-
final int offset = pName.indexOf( '.' );
58-
if ( offset == -1 )
59-
{
60-
return name + ext;
61-
}
62-
else
63-
{
64-
return name.substring( 0, offset ) + ext;
65-
}
66-
}
67-
}
1+
package org.codehaus.plexus.components.io.filemappers;
2+
3+
/**
4+
* An implementation of {@link FileMapper}, which changes the files extension.
5+
*/
6+
public class FileExtensionMapper extends IdentityMapper
7+
{
8+
/**
9+
* The file extension mappers role-hint: "fileExtension".
10+
*/
11+
public static final String ROLE_HINT = "fileExtension";
12+
13+
private String targetExtension;
14+
15+
/**
16+
* Sets the target files extension.
17+
*
18+
* @throws IllegalArgumentException
19+
* The target extension is null or empty.
20+
*/
21+
public void setTargetExtension( String pTargetExtension )
22+
{
23+
if ( pTargetExtension == null )
24+
{
25+
throw new IllegalArgumentException( "The target extension is null." );
26+
}
27+
if ( pTargetExtension.length() == 0 )
28+
{
29+
throw new IllegalArgumentException( "The target extension is empty." );
30+
}
31+
if ( pTargetExtension.charAt( 0 ) == '.' )
32+
{
33+
targetExtension = pTargetExtension;
34+
}
35+
else
36+
{
37+
targetExtension = '.' + pTargetExtension;
38+
}
39+
}
40+
41+
/**
42+
* Returns the target files extension.
43+
*/
44+
public String getTargetExtension()
45+
{
46+
return targetExtension;
47+
}
48+
49+
public String getMappedFileName( String pName )
50+
{
51+
final String ext = getTargetExtension();
52+
if ( ext == null )
53+
{
54+
throw new IllegalStateException( "The target extension has not been set." );
55+
}
56+
final String name = super.getMappedFileName( pName ); // Check arguments
57+
final int offset = pName.indexOf( '.' );
58+
if ( offset == -1 )
59+
{
60+
return name + ext;
61+
}
62+
else
63+
{
64+
return name.substring( 0, offset ) + ext;
65+
}
66+
}
67+
}
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
package org.codehaus.plexus.components.io.filemappers;
2-
3-
/**
4-
* Interface of a component, which may be used to map file names.
5-
*/
6-
public interface FileMapper
7-
{
8-
/**
9-
* Role used to register component implementations with the container.
10-
*/
11-
public static final String ROLE = FileMapper.class.getName();
12-
13-
/**
14-
* The default role-hint: "default".
15-
*/
16-
public static final String DEFAULT_ROLE_HINT = "default";
17-
18-
/**
19-
* Maps the given source name to a target name.
20-
*
21-
* @param pName
22-
* The source name.
23-
* @return The target name.
24-
* @throws IllegalArgumentException
25-
* The source name is null or empty.
26-
*/
27-
public String getMappedFileName( String pName );
28-
}
1+
package org.codehaus.plexus.components.io.filemappers;
2+
3+
/**
4+
* Interface of a component, which may be used to map file names.
5+
*/
6+
public interface FileMapper
7+
{
8+
/**
9+
* Role used to register component implementations with the container.
10+
*/
11+
public static final String ROLE = FileMapper.class.getName();
12+
13+
/**
14+
* The default role-hint: "default".
15+
*/
16+
public static final String DEFAULT_ROLE_HINT = "default";
17+
18+
/**
19+
* Maps the given source name to a target name.
20+
*
21+
* @param pName
22+
* The source name.
23+
* @return The target name.
24+
* @throws IllegalArgumentException
25+
* The source name is null or empty.
26+
*/
27+
public String getMappedFileName( String pName );
28+
}
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
package org.codehaus.plexus.components.io.filemappers;
2-
3-
/**
4-
* Implementation of a flattening file mapper: Removes all directory parts.
5-
*/
6-
public class FlattenFileMapper extends IdentityMapper
7-
{
8-
/**
9-
* The flatten file mappers role-hint: "flatten".
10-
*/
11-
public static final String ROLE_HINT = "flatten";
12-
13-
public String getMappedFileName( String pName )
14-
{
15-
String name = super.getMappedFileName( pName ); // Check for null, etc.
16-
int offset = pName.lastIndexOf( '/' );
17-
if ( offset >= 0 )
18-
{
19-
name = name.substring( offset + 1 );
20-
}
21-
offset = pName.lastIndexOf( '\\' );
22-
if ( offset >= 0 )
23-
{
24-
name = name.substring( offset + 1 );
25-
}
26-
return name;
27-
}
28-
}
1+
package org.codehaus.plexus.components.io.filemappers;
2+
3+
/**
4+
* Implementation of a flattening file mapper: Removes all directory parts.
5+
*/
6+
public class FlattenFileMapper extends IdentityMapper
7+
{
8+
/**
9+
* The flatten file mappers role-hint: "flatten".
10+
*/
11+
public static final String ROLE_HINT = "flatten";
12+
13+
public String getMappedFileName( String pName )
14+
{
15+
String name = super.getMappedFileName( pName ); // Check for null, etc.
16+
int offset = pName.lastIndexOf( '/' );
17+
if ( offset >= 0 )
18+
{
19+
name = name.substring( offset + 1 );
20+
}
21+
offset = pName.lastIndexOf( '\\' );
22+
if ( offset >= 0 )
23+
{
24+
name = name.substring( offset + 1 );
25+
}
26+
return name;
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
package org.codehaus.plexus.components.io.filemappers;
2-
3-
/**
4-
* Default implementation of {@link FileMapper}, which performs the identity mapping: All names are left unchanged.
5-
*/
6-
public class IdentityMapper implements FileMapper
7-
{
8-
/**
9-
* The identity mappers role-hint: "identity".
10-
*/
11-
public static final String ROLE_HINT = "identity";
12-
13-
public String getMappedFileName( String pName )
14-
{
15-
if ( pName == null || pName.length() == 0 )
16-
{
17-
throw new IllegalArgumentException( "The source name must not be null." );
18-
}
19-
return pName;
20-
}
21-
}
1+
package org.codehaus.plexus.components.io.filemappers;
2+
3+
/**
4+
* Default implementation of {@link FileMapper}, which performs the identity mapping: All names are left unchanged.
5+
*/
6+
public class IdentityMapper implements FileMapper
7+
{
8+
/**
9+
* The identity mappers role-hint: "identity".
10+
*/
11+
public static final String ROLE_HINT = "identity";
12+
13+
public String getMappedFileName( String pName )
14+
{
15+
if ( pName == null || pName.length() == 0 )
16+
{
17+
throw new IllegalArgumentException( "The source name must not be null." );
18+
}
19+
return pName;
20+
}
21+
}

0 commit comments

Comments
 (0)
Please sign in to comment.