1 | package org.apache.maven.continuum.web.action.notifier; |
2 | |
3 | /* |
4 | * Licensed to the Apache Software Foundation (ASF) under one |
5 | * or more contributor license agreements. See the NOTICE file |
6 | * distributed with this work for additional information |
7 | * regarding copyright ownership. The ASF licenses this file |
8 | * to you under the Apache License, Version 2.0 (the |
9 | * "License"); you may not use this file except in compliance |
10 | * with the License. You may obtain a copy of the License at |
11 | * |
12 | * http://www.apache.org/licenses/LICENSE-2.0 |
13 | * |
14 | * Unless required by applicable law or agreed to in writing, |
15 | * software distributed under the License is distributed on an |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
17 | * KIND, either express or implied. See the License for the |
18 | * specific language governing permissions and limitations |
19 | * under the License. |
20 | */ |
21 | |
22 | import java.util.HashMap; |
23 | import java.util.Map; |
24 | |
25 | import org.apache.maven.continuum.model.project.ProjectGroup; |
26 | import org.apache.maven.continuum.model.project.ProjectNotifier; |
27 | |
28 | /** |
29 | * Action that edits a {@link ProjectNotifier} of type 'IRC' from the |
30 | * specified {@link ProjectGroup}. |
31 | * |
32 | * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a> |
33 | * @version $Id: IrcGroupNotifierEditAction.java 766895 2009-04-20 22:02:13Z evenisse $ |
34 | * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="ircGroupNotifierEdit" |
35 | * @since 1.1 |
36 | */ |
37 | public class IrcGroupNotifierEditAction |
38 | extends AbstractGroupNotifierEditAction |
39 | { |
40 | private String host; |
41 | |
42 | private int port = 6667; |
43 | |
44 | private String channel; |
45 | |
46 | private String nick; |
47 | |
48 | private String alternateNick; |
49 | |
50 | private String username; |
51 | |
52 | private String fullName; |
53 | |
54 | private String password; |
55 | |
56 | private boolean ssl = false; |
57 | |
58 | protected void initConfiguration( Map<String, String> configuration ) |
59 | { |
60 | host = configuration.get( "host" ); |
61 | |
62 | if ( configuration.get( "port" ) != null ) |
63 | { |
64 | port = Integer.parseInt( configuration.get( "port" ) ); |
65 | } |
66 | |
67 | channel = configuration.get( "channel" ); |
68 | |
69 | nick = configuration.get( "nick" ); |
70 | |
71 | alternateNick = configuration.get( "alternateNick" ); |
72 | |
73 | username = configuration.get( "username" ); |
74 | |
75 | fullName = configuration.get( "fullName" ); |
76 | |
77 | password = configuration.get( "password" ); |
78 | |
79 | if ( configuration.get( "ssl" ) != null ) |
80 | { |
81 | ssl = Boolean.parseBoolean( configuration.get( "ssl" ) ); |
82 | } |
83 | } |
84 | |
85 | protected void setNotifierConfiguration( ProjectNotifier notifier ) |
86 | { |
87 | HashMap<String, String> configuration = new HashMap<String, String>(); |
88 | |
89 | configuration.put( "host", host ); |
90 | |
91 | configuration.put( "port", String.valueOf( port ) ); |
92 | |
93 | configuration.put( "channel", channel ); |
94 | |
95 | configuration.put( "nick", nick ); |
96 | |
97 | configuration.put( "alternateNick", alternateNick ); |
98 | |
99 | configuration.put( "username", username ); |
100 | |
101 | configuration.put( "fullName", fullName ); |
102 | |
103 | configuration.put( "password", password ); |
104 | |
105 | configuration.put( "ssl", String.valueOf( ssl ) ); |
106 | |
107 | notifier.setConfiguration( configuration ); |
108 | } |
109 | |
110 | public String getHost() |
111 | { |
112 | return host; |
113 | } |
114 | |
115 | public void setHost( String host ) |
116 | { |
117 | this.host = host; |
118 | } |
119 | |
120 | public int getPort() |
121 | { |
122 | return port; |
123 | } |
124 | |
125 | public void setPort( int port ) |
126 | { |
127 | this.port = port; |
128 | } |
129 | |
130 | public String getChannel() |
131 | { |
132 | return channel; |
133 | } |
134 | |
135 | public void setChannel( String channel ) |
136 | { |
137 | this.channel = channel; |
138 | } |
139 | |
140 | public String getNick() |
141 | { |
142 | return nick; |
143 | } |
144 | |
145 | public void setNick( String nick ) |
146 | { |
147 | this.nick = nick; |
148 | } |
149 | |
150 | public String getAlternateNick() |
151 | { |
152 | return alternateNick; |
153 | } |
154 | |
155 | public void setAlternateNick( String alternateNick ) |
156 | { |
157 | this.alternateNick = alternateNick; |
158 | } |
159 | |
160 | public String getUsername() |
161 | { |
162 | return username; |
163 | } |
164 | |
165 | public void setUsername( String username ) |
166 | { |
167 | this.username = username; |
168 | } |
169 | |
170 | public String getFullName() |
171 | { |
172 | return fullName; |
173 | } |
174 | |
175 | public void setFullName( String fullName ) |
176 | { |
177 | this.fullName = fullName; |
178 | } |
179 | |
180 | public String getPassword() |
181 | { |
182 | return password; |
183 | } |
184 | |
185 | public void setPassword( String password ) |
186 | { |
187 | this.password = password; |
188 | } |
189 | |
190 | public boolean isSsl() |
191 | { |
192 | return ssl; |
193 | } |
194 | |
195 | public void setSsl( boolean ssl ) |
196 | { |
197 | this.ssl = ssl; |
198 | } |
199 | } |