KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > security > forms > ShowIpRestrictionsForm


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.security.forms;
21
22 import org.apache.struts.action.ActionMapping;
23
24 import com.sslexplorer.core.forms.CoreForm;
25 import com.sslexplorer.security.IpRestriction;
26
27 /**
28  * An implementation of the ActionForm object.
29  *
30  * @author P.J.King
31  *
32  */

33 public class ShowIpRestrictionsForm extends CoreForm {
34
35     IpRestriction[] ipRestrictions;
36     String JavaDoc ipAddress;
37     String JavaDoc action;
38
39     public void initialize(IpRestriction[] ipRestrictions) {
40         this.ipRestrictions = ipRestrictions;
41     }
42
43     public String JavaDoc getAddress() {
44         return ipAddress;
45     }
46
47     public IpRestriction[] getRestrictions() {
48         return ipRestrictions;
49     }
50
51     public void setAddress(String JavaDoc ipAddress) {
52         this.ipAddress = ipAddress;
53     }
54
55     public void setAction(String JavaDoc action) {
56         this.action = action;
57     }
58
59     public boolean isAuthorized() {
60         return action != null && action.equals("allow");
61     }
62
63     public boolean isDisplayable() {
64         return ipRestrictions.length > 0;
65     }
66
67     public String JavaDoc getAction() {
68         return action;
69     }
70
71     public void reset(ActionMapping mapping, javax.servlet.http.HttpServletRequest JavaDoc request) {
72
73         ipRestrictions = null;
74         action = "";
75         ipAddress = "";
76     }
77
78 }
Popular Tags