001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: *
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or 1any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
020: * USA
021: *
022: * Initial developer: JOnAS team
023: * --------------------------------------------------------------------------
024: * $Id: JonasSession.java 8384 2006-05-24 11:30:11Z durieuxp $
025: * --------------------------------------------------------------------------
026: */package org.objectweb.jonas_ejb.deployment.xml;
027:
028: /**
029: * This class defines the implementation of the element jonas-session
030: *
031: * @author JOnAS team
032: */
033:
034: public class JonasSession extends JonasCommonEjb {
035:
036: /**
037: * is-modified-method-name
038: */
039: private String isModifiedMethodName = null;
040:
041: /**
042: * session-timeout
043: */
044: private String sessionTimeout = null;
045:
046: /**
047: * jndi-endpoint-name
048: */
049: private String jndiEndpointName = null;
050:
051: /**
052: * singleton
053: */
054: private String singleton = null;
055:
056: /**
057: * Constructor
058: */
059: public JonasSession() {
060: super ();
061: }
062:
063: /**
064: * Gets the is-modified-method-name
065: * @return the is-modified-method-name
066: */
067: public String getIsModifiedMethodName() {
068: return isModifiedMethodName;
069: }
070:
071: /**
072: * Set the is-modified-method-name
073: * @param isModifiedMethodName isModifiedMethodName
074: */
075: public void setIsModifiedMethodName(String isModifiedMethodName) {
076: this .isModifiedMethodName = isModifiedMethodName;
077: }
078:
079: /**
080: * Gets the session-timeout
081: * @return the session-timeout
082: */
083: public String getSessionTimeout() {
084: return sessionTimeout;
085: }
086:
087: /**
088: * Set the session-timeout
089: * @param sessionTimeout sessionTimeout
090: */
091: public void setSessionTimeout(String sessionTimeout) {
092: this .sessionTimeout = sessionTimeout;
093: }
094:
095: /**
096: * Gets the jndi-endpoint-name
097: * @return the jndi-endpoint-name
098: */
099: public String getJndiEndpointName() {
100: return jndiEndpointName;
101: }
102:
103: /**
104: * Gets the singleton flag
105: * @return the singleton flag
106: */
107: public String getSingleton() {
108: return singleton;
109: }
110:
111: /**
112: * Set the singleton flag
113: * @param singleton the singleton flag
114: */
115: public void setSingleton(String singleton) {
116: this .singleton = singleton;
117: }
118:
119: /**
120: * Set the jndi-endpoint-name
121: * @param jndiEndpointName jndi-endpoint-name
122: */
123: public void setJndiEndpointName(String jndiEndpointName) {
124: this .jndiEndpointName = jndiEndpointName;
125: }
126:
127: /**
128: * Represents this element by it's XML description.
129: * @param indent use this indent for prexifing XML representation.
130: * @return the XML description of this object.
131: */
132: public String toXML(int indent) {
133: StringBuffer sb = new StringBuffer();
134: sb.append(indent(indent));
135: sb.append("<jonas-session>\n");
136:
137: indent += 2;
138:
139: // ejb-name
140: sb.append(xmlElement(getEjbName(), "ejb-name", indent));
141: // jndi-name
142: sb.append(xmlElement(getJndiName(), "jndi-name", indent));
143: // jndi-local-name
144: sb.append(xmlElement(getJndiLocalName(), "jndi-local-name",
145: indent));
146: // jndi-endpoint-name
147: sb.append(xmlElement(getJndiEndpointName(),
148: "jndi-endpoint-name", indent));
149: // jonas-ejb-ref
150: sb.append(getJonasEjbRefList().toXML(indent));
151: // jonas-resource
152: sb.append(getJonasResourceList().toXML(indent));
153: // jonas-resource-env
154: sb.append(getJonasResourceEnvList().toXML(indent));
155: // jonas-service-ref
156: sb.append(getJonasServiceRefList().toXML(indent));
157: // jonas-message-destination-ref
158: sb.append(getJonasMessageDestinationRefList().toXML(indent));
159: // session-timeout
160: sb
161: .append(xmlElement(sessionTimeout, "session-timeout",
162: indent));
163: // max-cache-size
164: sb.append(xmlElement(getMaxCacheSize(), "max-cache-size",
165: indent));
166: // min-pool-size
167: sb
168: .append(xmlElement(getMinPoolSize(), "min-pool-size",
169: indent));
170: // singleton
171: sb.append(xmlElement(singleton, "singleton", indent));
172: // is-modified-method-name
173: if (isModifiedMethodName != null
174: && !isModifiedMethodName.equals("")) {
175: sb.append(xmlElement(isModifiedMethodName,
176: "is-modified-method-name", indent));
177: }
178:
179: // run-as
180: if (getRunAsPrincipalName() != null) {
181: sb.append(indent(indent));
182: sb.append("<run-as>\n");
183: indent += 2;
184: sb.append(xmlElement(getRunAsPrincipalName(),
185: "principal-name", indent));
186: indent -= 2;
187: sb.append(indent(indent));
188: sb.append("</run-as>\n");
189: }
190: // ior-security-config
191: if (getIorSecurityConfig() != null) {
192: sb.append(getIorSecurityConfig().toXML(indent));
193: }
194:
195: indent -= 2;
196: sb.append(indent(indent));
197: sb.append("</jonas-session>\n");
198:
199: return sb.toString();
200: }
201: }
|