12
12
* express or implied. See the License for the specific language governing
13
13
* permissions and limitations under the License.
14
14
*/
15
- package com .emc .ecs .sync .bean ;
15
+ package com .emc .ecs .sync .rest ;
16
16
17
17
import javax .xml .bind .annotation .XmlAttribute ;
18
18
import javax .xml .bind .annotation .XmlElement ;
19
19
import javax .xml .bind .annotation .XmlTransient ;
20
- import java . util . HashMap ;
21
- import java .util .Map ;
20
+ import javax . xml . bind . annotation . XmlType ;
21
+ import java .util .* ;
22
22
23
+ @ XmlType (propOrder = {"pluginClass" , "propEntries" , "listPropEntries" })
23
24
public class PluginConfig {
24
- protected Class pluginClass ;
25
+ protected String pluginClass ;
25
26
protected Map <String , String > customProperties = new HashMap <>();
27
+ protected Map <String , List <String >> customListProperties = new HashMap <>();
26
28
27
29
public PluginConfig () {
28
30
}
29
31
30
- public PluginConfig (Class pluginClass ) {
32
+ public PluginConfig (String pluginClass ) {
31
33
this .pluginClass = pluginClass ;
32
34
}
33
35
34
- @ XmlAttribute (name = "Class " )
35
- public Class getPluginClass () {
36
+ @ XmlAttribute (name = "class " )
37
+ public String getPluginClass () {
36
38
return pluginClass ;
37
39
}
38
40
39
- public void setPluginClass (Class pluginClass ) {
41
+ public void setPluginClass (String pluginClass ) {
40
42
this .pluginClass = pluginClass ;
41
43
}
42
44
@@ -57,6 +59,23 @@ public void setPropEntries(PropEntry[] propEntries) {
57
59
}
58
60
}
59
61
62
+ @ XmlElement (name = "ListProperty" )
63
+ public ListPropEntry [] getListPropEntries () {
64
+ ListPropEntry [] entries = new ListPropEntry [customListProperties .size ()];
65
+ int i = 0 ;
66
+ for (Map .Entry <String , List <String >> entry : customListProperties .entrySet ()) {
67
+ entries [i ++] = new ListPropEntry (entry .getKey (), new ArrayList <>(entry .getValue ()));
68
+ }
69
+ return entries ;
70
+ }
71
+
72
+ public void setListPropEntries (ListPropEntry [] listPropEntries ) {
73
+ customListProperties = new HashMap <>();
74
+ for (ListPropEntry entry : listPropEntries ) {
75
+ customListProperties .put (entry .getName (), new ArrayList <>(entry .getValues ()));
76
+ }
77
+ }
78
+
60
79
@ XmlTransient
61
80
public Map <String , String > getCustomProperties () {
62
81
return customProperties ;
@@ -66,7 +85,16 @@ public void setCustomProperties(Map<String, String> customProperties) {
66
85
this .customProperties = customProperties ;
67
86
}
68
87
69
- public PluginConfig withPluginClass (Class pluginClass ) {
88
+ @ XmlTransient
89
+ public Map <String , List <String >> getCustomListProperties () {
90
+ return customListProperties ;
91
+ }
92
+
93
+ public void setCustomListProperties (Map <String , List <String >> customListProperties ) {
94
+ this .customListProperties = customListProperties ;
95
+ }
96
+
97
+ public PluginConfig withPluginClass (String pluginClass ) {
70
98
setPluginClass (pluginClass );
71
99
return this ;
72
100
}
@@ -75,4 +103,9 @@ public PluginConfig addCustomProperty(String name, String value) {
75
103
customProperties .put (name , value );
76
104
return this ;
77
105
}
106
+
107
+ public PluginConfig addCustomListProperty (String name , String ... values ) {
108
+ customListProperties .put (name , Arrays .asList (values ));
109
+ return this ;
110
+ }
78
111
}
0 commit comments