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.Project;
23  import org.apache.maven.continuum.model.project.ProjectNotifier;
24  import org.apache.maven.continuum.notification.AbstractContinuumNotifier;
25  
26  import java.util.HashMap;
27  import java.util.Map;
28  
29  /**
30   * Action that edits a {@link ProjectNotifier} of type 'Jabber' from the
31   * specified {@link Project}.
32   *
33   * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
34   * @version $Id: JabberProjectNotifierEditAction.java 1372260 2012-08-13 04:29:09Z brett $
35   * @plexus.component role="com.opensymphony.xwork2.Action"role-hint="jabberProjectNotifierEdit"
36   */
37  public class JabberProjectNotifierEditAction
38      extends AbstractProjectNotifierEditAction
39  {
40      private String host;
41  
42      private int port = 5222;
43  
44      private String login;
45  
46      private String password;
47  
48      private String domainName;
49  
50      private String address;
51  
52      private boolean sslConnection;
53  
54      private boolean group;
55  
56      protected void initConfiguration( Map<String, String> configuration )
57      {
58          host = configuration.get( "host" );
59  
60          if ( configuration.get( "port" ) != null )
61          {
62              port = Integer.parseInt( configuration.get( "port" ) );
63          }
64  
65          login = configuration.get( "login" );
66  
67          password = configuration.get( "password" );
68  
69          domainName = configuration.get( "domainName" );
70  
71          address = configuration.get( AbstractContinuumNotifier.ADDRESS_FIELD );
72  
73          sslConnection = Boolean.valueOf( configuration.get( "sslConnection" ) );
74  
75          group = Boolean.valueOf( configuration.get( "isGroup" ) );
76      }
77  
78      protected void setNotifierConfiguration( ProjectNotifier notifier )
79      {
80          HashMap<String, String> configuration = new HashMap<String, String>();
81  
82          configuration.put( "host", host );
83  
84          configuration.put( "port", String.valueOf( port ) );
85  
86          configuration.put( "login", login );
87  
88          configuration.put( "password", password );
89  
90          configuration.put( "domainName", domainName );
91  
92          configuration.put( AbstractContinuumNotifier.ADDRESS_FIELD, address );
93  
94          configuration.put( "sslConnection", String.valueOf( sslConnection ) );
95  
96          configuration.put( "isGroup", String.valueOf( group ) );
97  
98          notifier.setConfiguration( configuration );
99      }
100 
101     public String getHost()
102     {
103         return host;
104     }
105 
106     public void setHost( String host )
107     {
108         this.host = host;
109     }
110 
111     public int getPort()
112     {
113         return port;
114     }
115 
116     public void setPort( int port )
117     {
118         this.port = port;
119     }
120 
121     public String getLogin()
122     {
123         return login;
124     }
125 
126     public void setLogin( String login )
127     {
128         this.login = login;
129     }
130 
131     public String getPassword()
132     {
133         return password;
134     }
135 
136     public void setPassword( String password )
137     {
138         this.password = password;
139     }
140 
141     public String getDomainName()
142     {
143         return domainName;
144     }
145 
146     public void setDomainName( String domainName )
147     {
148         this.domainName = domainName;
149     }
150 
151     public String getAddress()
152     {
153         return address;
154     }
155 
156     public void setAddress( String address )
157     {
158         this.address = address;
159     }
160 
161     public boolean isSslConnection()
162     {
163         return sslConnection;
164     }
165 
166     public void setSslConnection( boolean sslConnection )
167     {
168         this.sslConnection = sslConnection;
169     }
170 
171     public boolean isGroup()
172     {
173         return group;
174     }
175 
176     public void setGroup( boolean group )
177     {
178         this.group = group;
179     }
180 }