001: /**
002: * $Id: MessageDescriptorImpl.java,v 1.5 2003/06/03 10:49:23 sy131129 Exp $
003: * Copyright 2002-2003 Sun Microsystems, Inc. All
004: * rights reserved. Use of this product is subject
005: * to license terms. Federal Acquisitions:
006: * Commercial Software -- Government Users
007: * Subject to Standard License Terms and
008: * Conditions.
009: *
010: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011: * are trademarks or registered trademarks of Sun Microsystems,
012: * Inc. in the United States and other countries.
013: */package com.sun.portal.providers.simplewebservice.wsdl.impl;
014:
015: import java.util.Map;
016: import java.util.HashMap;
017: import java.util.List;
018: import java.util.Iterator;
019: import java.util.ArrayList;
020:
021: import com.sun.portal.providers.simplewebservice.wsdl.PartDescriptor;
022: import com.sun.portal.providers.simplewebservice.wsdl.MessageDescriptor;
023:
024: /**
025: * This class describes a message used for communication with an operation.
026: *
027: */
028: public class MessageDescriptorImpl implements MessageDescriptor {
029:
030: private String name = null;
031: private Map partDescriptors = new HashMap();
032: private List orderedPartDescriptors = new ArrayList();
033:
034: /**
035: * Default Constructor.
036: *
037: * @param name the name of the MessageDescriptor.
038: * @param partDescriptors the PartDescriptors that are part of this MessageDescriptor.
039: * @param orderedPartDescriptors the ordered list of PartDescriptor names.
040: *
041: */
042: public MessageDescriptorImpl(String name, Map partDescriptors,
043: List orderedPartDescriptors) {
044: this .name = name;
045: this .partDescriptors = partDescriptors;
046: this .orderedPartDescriptors = orderedPartDescriptors;
047: }
048:
049: /**
050: * Get the name of this MessageDescriptor.
051: *
052: * @return the MessageDescriptor name.
053: */
054: public String getName() {
055: return name;
056: }
057:
058: /**
059: * Get the specified PartDescriptor.
060: *
061: * @param name the name of the desired PartDescriptor.
062: *
063: * @return the corresponding PartDescriptor, or null if there wasn't
064: * any matching PartDescriptor.
065: */
066: public PartDescriptor getPartDescriptor(String name) {
067: return (PartDescriptor) partDescriptors.get(name);
068: }
069:
070: /**
071: * Get all the PartDescriptors defined here.
072: *
073: * @return all the PartDescriptors.
074: */
075: public Map getPartDescriptors() {
076: return partDescriptors;
077: }
078:
079: /**
080: * Get an ordered list of PartDescriptor names.
081: *
082: * @return the ordered list of PartDescriptor names.
083: */
084: public List getOrderedPartDescriptors() {
085: return orderedPartDescriptors;
086: }
087:
088: /**
089: * Get the String representation of this MessageDescriptor.
090: *
091: * @return the String representation of this MessageDescriptor.
092: */
093: public String toString() {
094: StringBuffer strBuf = new StringBuffer();
095:
096: strBuf.append("\nMessageDescriptor: name=" + name);
097:
098: if (partDescriptors != null) {
099: Iterator partDescriptorIterator = partDescriptors.values()
100: .iterator();
101:
102: while (partDescriptorIterator.hasNext()) {
103: strBuf.append("\n" + partDescriptorIterator.next());
104: }
105: }
106:
107: return strBuf.toString();
108: }
109: }
|