1 | |
package org.apache.maven.plugin.assembly.filter; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.codehaus.plexus.component.annotations.Component; |
23 | |
import org.codehaus.plexus.components.io.fileselectors.FileInfo; |
24 | |
|
25 | |
@Component( role = ContainerDescriptorHandler.class, hint = "metaInf-spring" ) |
26 | 0 | public class MetaInfSpringHandler |
27 | |
extends AbstractLineAggregatingHandler |
28 | |
{ |
29 | |
|
30 | |
private static final String SPRING_PATH_PREFIX = "META-INF/"; |
31 | |
|
32 | |
@Override |
33 | |
protected String getOutputPathPrefix( final FileInfo fileInfo ) |
34 | |
{ |
35 | 0 | return SPRING_PATH_PREFIX; |
36 | |
} |
37 | |
|
38 | |
@Override |
39 | |
protected boolean fileMatches( final FileInfo fileInfo ) |
40 | |
{ |
41 | 0 | final String path = fileInfo.getName(); |
42 | |
|
43 | 0 | String leftover = null; |
44 | 0 | if ( path.startsWith( "/META-INF/spring." ) ) |
45 | |
{ |
46 | 0 | leftover = path.substring( "/META-INF/spring.".length() ); |
47 | |
} |
48 | 0 | else if ( path.startsWith( "META-INF/spring." ) ) |
49 | |
{ |
50 | 0 | leftover = path.substring( "META-INF/spring.".length() - 1 ); |
51 | |
} |
52 | |
|
53 | 0 | return leftover != null && leftover.length() > 0; |
54 | |
} |
55 | |
|
56 | |
} |