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: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * Initial developer(s): Xavier Delplanque
022: * --------------------------------------------------------------------------
023: * $Id: VcHandler.java 4622 2004-04-19 13:49:54Z sauthieg $
024: * --------------------------------------------------------------------------
025: */package org.objectweb.jonas_ws.wsgen.generator.axis;
026:
027: import java.util.Iterator;
028: import java.util.List;
029: import java.util.Map;
030: import java.util.Vector;
031:
032: import javax.xml.namespace.QName;
033:
034: import org.objectweb.jonas_lib.deployment.api.HandlerDesc;
035:
036: /**
037: * Member of a VelocityContext. Contains information about a Handler (Ref/Desc).
038: *
039: * @author Xavier Delplanque
040: */
041: public class VcHandler {
042:
043: /** handler name (unique) */
044: private String name;
045:
046: /** handler class name */
047: private String className;
048:
049: /** handler init parameters */
050: private Vector initParameters;
051:
052: /** handler SOAP headers */
053: private Vector headers;
054:
055: /** handler SOAP roles */
056: private Vector soapRoles;
057:
058: /**
059: * Create a new VcHandler from a HandlerDesc
060: *
061: * @param hr HandlerDesc
062: */
063: public VcHandler(HandlerDesc hr) {
064:
065: // set name
066: name = hr.getName();
067:
068: //set className
069: className = hr.getHandlerClass().getName();
070:
071: // set initParameters
072: Map ips = hr.getInitParams();
073: initParameters = new Vector();
074: for (Iterator itKey = ips.keySet().iterator(); itKey.hasNext();) {
075: String key = (String) itKey.next();
076: String val = (String) ips.get(key);
077: initParameters.add(new VcInitParam(key, val));
078: }
079:
080: // set headers
081: List hs = hr.getSOAPHeaders();
082: headers = new Vector();
083: for (Iterator itH = hs.iterator(); itH.hasNext();) {
084: QName qn = (QName) itH.next();
085: headers.add(new VcHeader(qn));
086: }
087:
088: // set soapRoles
089: soapRoles = new Vector();
090: List srs = hr.getSOAPRoles();
091: for (Iterator itSr = srs.iterator(); itSr.hasNext();) {
092: String sr = (String) itSr.next();
093: soapRoles.add(sr);
094: }
095: }
096:
097: /**
098: * @return Returns the Handler name
099: */
100: public String getName() {
101: return name;
102: }
103:
104: /**
105: * @return Returns the handler classname
106: */
107: public String getClassName() {
108: return className;
109: }
110:
111: /**
112: * @return Returns the list of handler init param
113: */
114: public Vector getInitParameters() {
115: return initParameters;
116: }
117:
118: /**
119: * @return Returns the list of header the given Handler is able to access.
120: */
121: public Vector getHeaders() {
122: return headers;
123: }
124:
125: /**
126: * @return Returns the list of SOAP roles the Handler use
127: */
128: public Vector getSoapRoles() {
129: return soapRoles;
130: }
131:
132: }
|