1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.config.spring.parsers.specific; |
12 | |
|
13 | |
import org.mule.api.security.EndpointSecurityFilter; |
14 | |
import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; |
15 | |
import org.mule.config.spring.parsers.delegate.ParentContextDefinitionParser; |
16 | |
import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser; |
17 | |
import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; |
18 | |
import org.mule.config.spring.parsers.generic.WrappingChildDefinitionParser; |
19 | |
import org.mule.processor.SecurityFilterMessageProcessor; |
20 | |
|
21 | |
import org.w3c.dom.Element; |
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
public class SecurityFilterDefinitionParser extends ParentContextDefinitionParser implements WrappingChildDefinitionParser.WrappingController |
28 | |
{ |
29 | |
|
30 | |
public static final String SECURITY_FILTER = "filter"; |
31 | |
public static final String ATTRIBUTE_NAME = AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME; |
32 | |
|
33 | |
public SecurityFilterDefinitionParser(Class filter) |
34 | |
{ |
35 | 0 | super(MuleOrphanDefinitionParser.ROOT_ELEMENT, new OrphanDefinitionParser(filter, false)); |
36 | 0 | otherwise( |
37 | |
new WrappingChildDefinitionParser( |
38 | |
"messageProcessor", filter, EndpointSecurityFilter.class, false, SecurityFilterMessageProcessor.class, |
39 | |
SECURITY_FILTER, SECURITY_FILTER, this)); |
40 | 0 | addIgnored(ATTRIBUTE_NAME); |
41 | 0 | } |
42 | |
|
43 | |
public SecurityFilterDefinitionParser() |
44 | |
{ |
45 | 0 | super(MuleOrphanDefinitionParser.ROOT_ELEMENT, new OrphanDefinitionParser(false)); |
46 | 0 | otherwise( |
47 | |
new WrappingChildDefinitionParser( |
48 | |
"messageProcessor", null, EndpointSecurityFilter.class, true, SecurityFilterMessageProcessor.class, |
49 | |
SECURITY_FILTER, SECURITY_FILTER, this)); |
50 | 0 | addIgnored(ATTRIBUTE_NAME); |
51 | 0 | } |
52 | |
|
53 | |
public boolean shouldWrap(Element elm) |
54 | |
{ |
55 | 0 | return true; |
56 | |
} |
57 | |
} |