KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > serverbeans > SessionConfig


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23  
24 /**
25  * This generated bean class SessionConfig matches the DTD element session-config
26  *
27  */

28
29 package com.sun.enterprise.config.serverbeans;
30
31 import org.w3c.dom.*;
32 import org.netbeans.modules.schema2beans.*;
33 import java.beans.*;
34 import java.util.*;
35 import java.io.Serializable JavaDoc;
36 import com.sun.enterprise.config.ConfigBean;
37 import com.sun.enterprise.config.ConfigException;
38 import com.sun.enterprise.config.StaleWriteConfigException;
39 import com.sun.enterprise.util.i18n.StringManager;
40
41 // BEGIN_NOI18N
42

43 public class SessionConfig extends ConfigBean implements Serializable JavaDoc
44 {
45
46     static Vector comparators = new Vector();
47     private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(4, 2, 0);
48
49     static public final String JavaDoc SESSION_MANAGER = "SessionManager";
50     static public final String JavaDoc SESSION_PROPERTIES = "SessionProperties";
51
52     public SessionConfig() {
53         this(Common.USE_DEFAULT_VALUES);
54     }
55
56     public SessionConfig(int options)
57     {
58         super(comparators, runtimeVersion);
59         // Properties (see root bean comments for the bean graph)
60
initPropertyTables(2);
61         this.createProperty("session-manager", SESSION_MANAGER,
62             Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
63             SessionManager.class);
64         this.createProperty("session-properties", SESSION_PROPERTIES,
65             Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY,
66             SessionProperties.class);
67         this.createAttribute(SESSION_PROPERTIES, "timeout-in-seconds", "TimeoutInSeconds",
68                         AttrProp.CDATA | AttrProp.IMPLIED,
69                         null, null);
70         this.initialize(options);
71     }
72
73     // Setting the default values of the properties
74
void initialize(int options) {
75
76     }
77
78     // This attribute is optional
79
public void setSessionManager(SessionManager value) {
80         this.setValue(SESSION_MANAGER, value);
81     }
82
83     // Get Method
84
public SessionManager getSessionManager() {
85         return (SessionManager)this.getValue(SESSION_MANAGER);
86     }
87
88     // This attribute is optional
89
public void setSessionProperties(SessionProperties value) {
90         this.setValue(SESSION_PROPERTIES, value);
91     }
92
93     // Get Method
94
public SessionProperties getSessionProperties() {
95         return (SessionProperties)this.getValue(SESSION_PROPERTIES);
96     }
97
98     /**
99      * Create a new bean using it's default constructor.
100      * This does not add it to any bean graph.
101      */

102     public SessionManager newSessionManager() {
103         return new SessionManager();
104     }
105
106     /**
107      * Create a new bean using it's default constructor.
108      * This does not add it to any bean graph.
109      */

110     public SessionProperties newSessionProperties() {
111         return new SessionProperties();
112     }
113
114     /**
115     * get the xpath representation for this element
116     * returns something like abc[@name='value'] or abc
117     * depending on the type of the bean
118     */

119     protected String JavaDoc getRelativeXPath() {
120         String JavaDoc ret = null;
121         ret = "session-config";
122         return (null != ret ? ret.trim() : null);
123     }
124
125     /*
126     * generic method to get default value from dtd
127     */

128     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
129         if(attr == null) return null;
130         attr = attr.trim();
131     return null;
132     }
133     //
134
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
135         comparators.add(c);
136     }
137
138     //
139
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
140         comparators.remove(c);
141     }
142     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
143     }
144
145     // Dump the content of this bean returning it as a String
146
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
147         String JavaDoc s;
148         Object JavaDoc o;
149         org.netbeans.modules.schema2beans.BaseBean n;
150         str.append(indent);
151         str.append("SessionManager"); // NOI18N
152
n = (org.netbeans.modules.schema2beans.BaseBean) this.getSessionManager();
153         if (n != null)
154             n.dump(str, indent + "\t"); // NOI18N
155
else
156             str.append(indent+"\tnull"); // NOI18N
157
this.dumpAttributes(SESSION_MANAGER, 0, str, indent);
158
159         str.append(indent);
160         str.append("SessionProperties"); // NOI18N
161
n = (org.netbeans.modules.schema2beans.BaseBean) this.getSessionProperties();
162         if (n != null)
163             n.dump(str, indent + "\t"); // NOI18N
164
else
165             str.append(indent+"\tnull"); // NOI18N
166
this.dumpAttributes(SESSION_PROPERTIES, 0, str, indent);
167
168     }
169     public String JavaDoc dumpBeanNode(){
170         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
171         str.append("SessionConfig\n"); // NOI18N
172
this.dump(str, "\n "); // NOI18N
173
return str.toString();
174     }}
175
176 // END_NOI18N
177

178
Popular Tags