|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| package org.acegisecurity.intercept.method; |
|
17 |
| |
|
18 |
| import org.acegisecurity.ConfigAttributeDefinition; |
|
19 |
| import org.acegisecurity.ConfigAttributeEditor; |
|
20 |
| |
|
21 |
| import org.apache.commons.logging.Log; |
|
22 |
| import org.apache.commons.logging.LogFactory; |
|
23 |
| |
|
24 |
| import org.springframework.beans.propertyeditors.PropertiesEditor; |
|
25 |
| |
|
26 |
| import java.beans.PropertyEditorSupport; |
|
27 |
| |
|
28 |
| import java.util.Iterator; |
|
29 |
| import java.util.Properties; |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
| |
|
42 |
| |
|
43 |
| public class MethodDefinitionSourceEditor extends PropertyEditorSupport { |
|
44 |
| |
|
45 |
| |
|
46 |
| private static final Log logger = LogFactory.getLog(MethodDefinitionSourceEditor.class); |
|
47 |
| |
|
48 |
| |
|
49 |
| |
|
50 |
27
| public void setAsText(String s) throws IllegalArgumentException {
|
|
51 |
27
| MethodDefinitionMap source = new MethodDefinitionMap();
|
|
52 |
| |
|
53 |
27
| if ((s == null) || "".equals(s)) {
|
|
54 |
| |
|
55 |
| } else { |
|
56 |
| |
|
57 |
25
| PropertiesEditor propertiesEditor = new PropertiesEditor();
|
|
58 |
25
| propertiesEditor.setAsText(s);
|
|
59 |
| |
|
60 |
25
| Properties props = (Properties) propertiesEditor.getValue();
|
|
61 |
| |
|
62 |
| |
|
63 |
25
| ConfigAttributeEditor configAttribEd = new ConfigAttributeEditor();
|
|
64 |
| |
|
65 |
25
| for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
|
|
66 |
50
| String name = (String) iter.next();
|
|
67 |
50
| String value = props.getProperty(name);
|
|
68 |
| |
|
69 |
| |
|
70 |
50
| configAttribEd.setAsText(value);
|
|
71 |
| |
|
72 |
50
| ConfigAttributeDefinition attr = (ConfigAttributeDefinition) configAttribEd
|
|
73 |
| .getValue(); |
|
74 |
| |
|
75 |
| |
|
76 |
50
| source.addSecureMethod(name, attr);
|
|
77 |
| } |
|
78 |
| } |
|
79 |
| |
|
80 |
24
| setValue(source);
|
|
81 |
| } |
|
82 |
| } |