001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)ExtensibleDocumentedComponent.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.wsdl2.impl;
030:
031: import org.apache.xmlbeans.XmlObject;
032: import org.w3.ns.wsdl.ExtensibleDocumentedType;
033:
034: /**
035: * Abstract implementation of
036: * Base for extensible, documented components
037: *
038: * @author Sun Microsystems, Inc.
039: */
040: abstract class ExtensibleDocumentedComponent implements
041: com.sun.jbi.wsdl2.ExtensibleDocumentedComponent {
042: /**
043: * The base XML object we are dealing with. This can be downcast to
044: * ExtensibleDocumentedType safely.
045: */
046: protected XmlObject mXmlObject;
047:
048: /**
049: * Get the extensible, documented XML bean for this (abstract) component.
050: *
051: * @return The extensible, documented XML bean for this component.
052: */
053: protected final ExtensibleDocumentedType getExBean() {
054: return (ExtensibleDocumentedType) this .mXmlObject;
055: }
056:
057: /** The extensions for this component, if any. */
058: private ExtensionsImpl mExtensions = null;
059:
060: /**
061: * Construct a new extensible, documented component whose contents
062: * are within the given XML bean.
063: *
064: * @param xmlObject The XML bean containing this component's contents.
065: */
066: ExtensibleDocumentedComponent(XmlObject xmlObject) {
067: this .mXmlObject = xmlObject;
068: }
069:
070: /**
071: * Get the container for this component.
072: *
073: * @return The container for this component.
074: */
075: protected abstract DescriptionImpl getContainer();
076:
077: /**
078: * Get documentation for component, if any.
079: * @param i index by which this document is obtained
080: *
081: * @return documentation for component, if any
082: */
083: public com.sun.jbi.wsdl2.Document getDocument(int i) {
084: return DocumentImpl.Factory.getInstance(getExBean()
085: .getDocumentationArray(i), this , getContainer());
086: }
087:
088: /**
089: * Get documentation for component, if any.
090: * This method is for backward compatibility, it always returns
091: * the first document (i.e., index = 0)
092: *
093: * @deprecated - replaced by getDocument(int i)
094: * @return documentation for component, if any
095: */
096: public com.sun.jbi.wsdl2.Document getDocument() {
097: return getDocument(0);
098: }
099:
100: /**
101: * Set documentation for component, if any.
102: * @param i index by which this document is set
103: *
104: * @param theDocument documentation for component, if any
105: */
106: public void setDocument(int i,
107: com.sun.jbi.wsdl2.Document theDocument) {
108: getExBean().setDocumentationArray(
109: i,
110: theDocument != null ? ((DocumentImpl) theDocument)
111: .getBean() : null);
112: }
113:
114: /**
115: * Set documentation for component, if any.
116: * This method is for backward compatibility, it always set the
117: * the document which has the index = 0
118: *
119: * @deprecated - replaced by setDocument(int i, Document theDocument);
120: * @param theDocument documentation for component, if any
121: */
122: public void setDocument(com.sun.jbi.wsdl2.Document theDocument) {
123: setDocument(0, theDocument);
124: }
125:
126: /**
127: * Get extensions for component, if any.
128: *
129: * @return extensions for component, if any
130: */
131: public com.sun.jbi.wsdl2.Extensions getExtensions() {
132: return this .mExtensions;
133: }
134:
135: /**
136: * Set extensions for component, if any.
137: *
138: * @param theExtensions extensions for component, if any
139: */
140: public void setExtensions(com.sun.jbi.wsdl2.Extensions theExtensions) {
141: return; // $$TODO
142: }
143:
144: }
145:
146: // End-of-file: ExtensibleDocumentedComponent.java
|