001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.axis2.schema.writer;
020:
021: import javax.xml.namespace.QName;
022: import org.apache.axis2.schema.BeanWriterMetaInfoHolder;
023: import org.apache.axis2.schema.CompilerOptions;
024: import org.apache.axis2.schema.SchemaCompilationException;
025: import org.apache.ws.commons.schema.XmlSchemaComplexType;
026: import org.apache.ws.commons.schema.XmlSchemaElement;
027: import org.apache.ws.commons.schema.XmlSchemaSimpleType;
028:
029: import java.io.IOException;
030: import java.util.Map;
031:
032: /**
033: * The bean writer interface. The schema compiler expects one of these to be
034: * presented to it and calls the appropriate methods
035: */
036: public interface BeanWriter {
037:
038: /**
039: * Initializes the writer with compiler options.
040: *
041: * @param options
042: * @throws IOException
043: */
044: public void init(CompilerOptions options)
045: throws SchemaCompilationException;
046:
047: /**
048: * Writes a wrapped class. This will have effect only if the CompilerOptions wrapclassses
049: * returns true.
050: */
051: public void writeBatch() throws SchemaCompilationException;
052:
053: /**
054: * Gets a map of models. This is useful for tight integrations where the internal workings
055: * of the schema compiler may be exposed.
056: */
057: public Map getModelMap();
058:
059: /** Make the fully qualified class name for an element or named type
060: * @param qName the qualified Name for this element or type in the schema
061: * @return the appropriate fully qualified class name to use in generated code
062: */
063: public String makeFullyQualifiedClassName(QName qName);
064:
065: /**
066: * Write a complex type
067: *
068: * @param complexType
069: * @param typeMap
070: * @param metainf
071: * @param fullyQualifiedClassName the name returned by makeFullyQualifiedClassName() or null if it wasn't called
072: * @return Returns String.
073: * @throws SchemaCompilationException
074: */
075: public String write(QName qname, Map typeMap,
076: BeanWriterMetaInfoHolder metainf, boolean isAbstract)
077: throws SchemaCompilationException;
078:
079: /**
080: * Write a element
081: *
082: * @param element
083: * @param typeMap
084: * @param metainf
085: * @return Returns String.
086: * @throws SchemaCompilationException
087: */
088: public String write(XmlSchemaElement element, Map typeMap,
089: BeanWriterMetaInfoHolder metainf)
090: throws SchemaCompilationException;
091:
092: /**
093: * Write a simple type
094: *
095: * @param simpleType
096: * @param typeMap
097: * @param metainf
098: * @return Returns String.
099: * @throws SchemaCompilationException
100: */
101: public String write(XmlSchemaSimpleType simpleType, Map typeMap,
102: BeanWriterMetaInfoHolder metainf)
103: throws SchemaCompilationException;
104:
105: /**
106: * Find whether the mapper class name is present
107: * @param mapperPackageName
108: */
109: public String getExtensionMapperPackageName();
110:
111: /**
112: * Registers the mapper package name - this is relevant to languages
113: * that enforce packaging such as Java or C#. May be ignored in other
114: * languages
115: * @param mapperPackageName
116: */
117: public void registerExtensionMapperPackageName(
118: String mapperPackageName);
119:
120: /**
121: * Write the extensions mapper component - this is relevant to only the OOP languages
122: * and a particular implementation may ignore this
123: * @param metainfArray
124: * @param namespaceToUse
125: */
126: public void writeExtensionMapper(
127: BeanWriterMetaInfoHolder[] metainfArray)
128: throws SchemaCompilationException;
129:
130: public String getDefaultClassName();
131:
132: public String getDefaultClassArrayName();
133:
134: public String getDefaultAttribClassName();
135:
136: public String getDefaultAttribArrayClassName();
137:
138: }
|