View Javadoc

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 org.apache.maven.continuum.model.project.ProjectNotifier;
23  
24  import java.util.HashMap;
25  import java.util.Map;
26  
27  /**
28   * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
29   * @version $Id: IrcProjectNotifierEditAction.java 1372260 2012-08-13 04:29:09Z brett $
30   * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="ircProjectNotifierEdit"
31   */
32  public class IrcProjectNotifierEditAction
33      extends AbstractProjectNotifierEditAction
34  {
35      private String host;
36  
37      private int port = 6667;
38  
39      private String channel;
40  
41      private String nick;
42  
43      private String alternateNick;
44  
45      private String username;
46  
47      private String fullName;
48  
49      private String password;
50  
51      private boolean ssl = false;
52  
53      protected void initConfiguration( Map<String, String> configuration )
54      {
55          host = configuration.get( "host" );
56  
57          if ( configuration.get( "port" ) != null )
58          {
59              port = Integer.parseInt( configuration.get( "port" ) );
60          }
61  
62          channel = configuration.get( "channel" );
63  
64          nick = configuration.get( "nick" );
65  
66          alternateNick = configuration.get( "alternateNick" );
67  
68          username = configuration.get( "username" );
69  
70          fullName = configuration.get( "fullName" );
71  
72          password = configuration.get( "password" );
73  
74          if ( configuration.get( "ssl" ) != null )
75          {
76              ssl = Boolean.parseBoolean( configuration.get( "ssl" ) );
77          }
78      }
79  
80      protected void setNotifierConfiguration( ProjectNotifier notifier )
81      {
82          HashMap<String, String> configuration = new HashMap<String, String>();
83  
84          configuration.put( "host", host );
85  
86          configuration.put( "port", String.valueOf( port ) );
87  
88          configuration.put( "channel", channel );
89  
90          configuration.put( "nick", nick );
91  
92          configuration.put( "alternateNick", alternateNick );
93  
94          configuration.put( "username", username );
95  
96          configuration.put( "fullName", fullName );
97  
98          configuration.put( "password", password );
99  
100         configuration.put( "ssl", String.valueOf( ssl ) );
101 
102         notifier.setConfiguration( configuration );
103     }
104 
105     public String getHost()
106     {
107         return host;
108     }
109 
110     public void setHost( String host )
111     {
112         this.host = host;
113     }
114 
115     public int getPort()
116     {
117         return port;
118     }
119 
120     public void setPort( int port )
121     {
122         this.port = port;
123     }
124 
125     public String getChannel()
126     {
127         return channel;
128     }
129 
130     public void setChannel( String channel )
131     {
132         this.channel = channel;
133     }
134 
135     public String getNick()
136     {
137         return nick;
138     }
139 
140     public void setNick( String nick )
141     {
142         this.nick = nick;
143     }
144 
145     public String getAlternateNick()
146     {
147         return alternateNick;
148     }
149 
150     public void setAlternateNick( String alternateNick )
151     {
152         this.alternateNick = alternateNick;
153     }
154 
155     public String getUsername()
156     {
157         return username;
158     }
159 
160     public void setUsername( String username )
161     {
162         this.username = username;
163     }
164 
165     public String getFullName()
166     {
167         return fullName;
168     }
169 
170     public void setFullName( String fullName )
171     {
172         this.fullName = fullName;
173     }
174 
175     public String getPassword()
176     {
177         return password;
178     }
179 
180     public void setPassword( String password )
181     {
182         this.password = password;
183     }
184 
185     public boolean isSsl()
186     {
187         return ssl;
188     }
189 
190     public void setSsl( boolean ssl )
191     {
192         this.ssl = ssl;
193     }
194 }