001: /**
002: * $Id: TypeDescriptorImpl.java,v 1.5 2003/06/03 10:49:24 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.TypeDescriptor;
022: import com.sun.portal.providers.simplewebservice.wsdl.TypeElementDescriptor;
023:
024: /**
025: * This class describes a type defined in the definition.
026: *
027: */
028: public class TypeDescriptorImpl implements TypeDescriptor {
029:
030: private String name = null;
031: private Map typeElementDescriptors = new HashMap();
032: private List orderedTypeElementDescriptors = new ArrayList();
033: private String typesSchemaTargetNamespace = null;
034:
035: private boolean arrayType = false;
036: private String arrayTypeName = null;
037:
038: /**
039: * Default Constructor.
040: *
041: * @param name the name of the TypeDescriptor.
042: * @param typeElementDescriptors the TypeElementDescriptors that are typeElement of this TypeDescriptor.
043: * @param orderedTypeElementDescriptors the ordered list of TypeElementDescriptor names.
044: *
045: */
046: public TypeDescriptorImpl(String name, Map typeElementDescriptors,
047: List orderedTypeElementDescriptors,
048: String typesSchemaTargetNamespace) {
049: this .name = name;
050: this .typeElementDescriptors = typeElementDescriptors;
051: this .orderedTypeElementDescriptors = orderedTypeElementDescriptors;
052: this .typesSchemaTargetNamespace = typesSchemaTargetNamespace;
053: }
054:
055: /**
056: * Get the name of this TypeDescriptor.
057: *
058: * @return the TypeDescriptor name.
059: */
060: public String getName() {
061: return name;
062: }
063:
064: /**
065: * Get the specified TypeElementDescriptor.
066: *
067: * @param name the name of the desired TypeElementDescriptor.
068: *
069: * @return the corresponding TypeElementDescriptor, or null if there wasn't
070: * any matching TypeElementDescriptor.
071: */
072: public TypeElementDescriptor getTypeElementDescriptor(String name) {
073: return (TypeElementDescriptor) typeElementDescriptors.get(name);
074: }
075:
076: /**
077: * Get all the TypeElementDescriptors defined here.
078: *
079: * @return all the TypeElementDescriptors.
080: */
081: public Map getTypeElementDescriptors() {
082: return typeElementDescriptors;
083: }
084:
085: /**
086: * Get an ordered list of TypeElementDescriptors.
087: *
088: * @return the list of TypeElementDescriptor names.
089: */
090: public List getOrderedTypeElementDescriptors() {
091: return orderedTypeElementDescriptors;
092: }
093:
094: /**
095: * Get the Target Namesapce of this TypeDescriptor.
096: *
097: * @return the TypeDescriptor Target Namespace.
098: */
099: public String getSchemaTargetNamespace() {
100: return typesSchemaTargetNamespace;
101: }
102:
103: public boolean isArrayType() {
104: return this .arrayType;
105: }
106:
107: public void setArrayType(boolean isArrayType) {
108: this .arrayType = isArrayType;
109: }
110:
111: public String getArrayTypeName() {
112: return this .arrayTypeName;
113: }
114:
115: public void setArrayTypeName(String typeName) {
116: this .arrayTypeName = typeName;
117: }
118:
119: /**
120: * Get the String representation of this TypeDescriptor.
121: *
122: * @return the String representation of this TypeDescriptor.
123: */
124: public String toString() {
125: StringBuffer strBuf = new StringBuffer();
126:
127: strBuf.append("\nTypeDescriptor: name=" + name);
128:
129: if (typeElementDescriptors != null) {
130: Iterator typeElementDescriptorIterator = typeElementDescriptors
131: .values().iterator();
132:
133: while (typeElementDescriptorIterator.hasNext()) {
134: strBuf.append("\n"
135: + typeElementDescriptorIterator.next());
136: }
137: }
138:
139: strBuf.append("\nSchema Target Namespace="
140: + typesSchemaTargetNamespace);
141:
142: return strBuf.toString();
143: }
144: }
|