KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > webapp > admin > users > BaseForm


1 /*
2  * Copyright 2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.webapp.admin.users;
18
19
20 import javax.management.ObjectName JavaDoc;
21 import javax.servlet.http.HttpServletRequest JavaDoc;
22 import org.apache.struts.action.ActionError;
23 import org.apache.struts.action.ActionErrors;
24 import org.apache.struts.action.ActionForm;
25 import org.apache.struts.action.ActionMapping;
26
27
28 /**
29  * Base class for form beans for the user administration
30  * options.
31  *
32  * @author Craig R. McClanahan
33  * @version $Revision: 1.2 $ $Date: 2004/02/27 14:59:05 $
34  * @since 4.1
35  */

36
37 public class BaseForm extends ActionForm {
38
39
40     // ----------------------------------------------------- Instance Variables
41

42
43     // ------------------------------------------------------------- Properties
44

45
46     /**
47      * The MBean Name of UserDatabase containing this object.
48      */

49     private String JavaDoc databaseName = null;
50
51     public String JavaDoc getDatabaseName() {
52         if ((this.databaseName == null) && (this.objectName != null)) {
53             try {
54                 ObjectName JavaDoc oname = new ObjectName JavaDoc(this.objectName);
55                 this.databaseName = oname.getDomain() + ":" +
56                   "type=UserDatabase,database=" +
57                   oname.getKeyProperty("database");
58             } catch (Throwable JavaDoc t) {
59                 this.databaseName = null;
60             }
61         }
62         return (this.databaseName);
63     }
64
65     public void setDatabaseName(String JavaDoc databaseName) {
66         if ((databaseName != null) && (databaseName.length() < 1)) {
67             this.databaseName = null;
68         } else {
69             this.databaseName = databaseName;
70         }
71     }
72
73
74     /**
75      * The node label to be displayed in the user interface.
76      */

77     private String JavaDoc nodeLabel = null;
78
79     public String JavaDoc getNodeLabel() {
80         return (this.nodeLabel);
81     }
82
83     public void setNodeLabel(String JavaDoc nodeLabel) {
84         this.nodeLabel = nodeLabel;
85     }
86
87
88     /**
89      * The MBean object name of this object. A null or zero-length
90      * value indicates that this is a new object.
91      */

92     private String JavaDoc objectName = null;
93
94     public String JavaDoc getObjectName() {
95         return (this.objectName);
96     }
97
98     public void setObjectName(String JavaDoc objectName) {
99         if ((objectName != null) && (objectName.length() < 1)) {
100             this.objectName = null;
101         } else {
102             this.objectName = objectName;
103         }
104     }
105
106
107     // --------------------------------------------------------- Public Methods
108

109     /**
110      * Reset all properties to their default values.
111      *
112      * @param mapping The mapping used to select this instance
113      * @param request The servlet request we are processing
114      */

115     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request) {
116
117         databaseName = null;
118         nodeLabel = null;
119         objectName = null;
120
121     }
122
123
124 }
125
Popular Tags