1 package org.apache.maven.plugins.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
26
27
28 @Component( role = ContainerDescriptorHandler.class, hint = "metaInf-spring", instantiationStrategy = "per-lookup" )
29 public class MetaInfSpringHandler
30 extends AbstractLineAggregatingHandler
31 {
32
33 private static final String SPRING_PATH_PREFIX = "META-INF/";
34
35 @Override
36 protected String getOutputPathPrefix( final FileInfo fileInfo )
37 {
38 return SPRING_PATH_PREFIX;
39 }
40
41 @Override
42 protected boolean fileMatches( final FileInfo fileInfo )
43 {
44 final String path = fileInfo.getName();
45
46 String leftover = null;
47 if ( path.startsWith( "/META-INF/spring." ) )
48 {
49 leftover = path.substring( "/META-INF/spring.".length() );
50 }
51 else if ( path.startsWith( "META-INF/spring." ) )
52 {
53 leftover = path.substring( "META-INF/spring.".length() - 1 );
54 }
55
56 return leftover != null && leftover.length() > 0;
57 }
58
59 }