|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.xsd.ecore.NameMangler
org.eclipse.xsd.ecore.MapBuilder
org.eclipse.xsd.ecore.EcoreXMLSchemaBuilder
public class EcoreXMLSchemaBuilder
This class produces an XSDSchema given an Ecore EPackage. The XSDSchema is an XML schema.
Nested Class Summary | |
---|---|
static interface |
EcoreXMLSchemaBuilder.QNameMap
|
Nested classes/interfaces inherited from class org.eclipse.xsd.ecore.MapBuilder |
---|
MapBuilder.Mapper |
Field Summary | |
---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
ecoreToSchemaName
|
protected static java.lang.String |
EMF_SCHEMA_NAME
|
protected static java.lang.String |
EMF_SCHEMA_PREFIX
|
protected static java.lang.String |
EMF_SCHEMA_URI
|
protected XSDSchema |
emfSchema
|
protected boolean |
enforceLowerBound
|
protected EPackage |
ePackage
|
protected java.util.Map<EPackage,java.lang.String> |
ePackageToNsPrefixMap
|
protected java.util.Map<EPackage,XSDSchema> |
ePackageToXSDSchemaMap
|
protected boolean |
minimizedXMI
|
static java.lang.String |
OPTION_TO_ENFORCE_LOWERBOUND
|
static java.lang.String |
OPTION_USE_ENCODED_ATTRIBUTE_STYLE
|
protected EcoreXMLSchemaBuilder.QNameMap |
qNameMap
|
protected static java.lang.String |
REFERENCE_TYPE_NAME
|
protected java.util.List<EClass> |
rootClasses
|
protected boolean |
useEncodedAttributeStyle
|
protected XSDParser |
xsdParser
|
protected XSDSchema |
xsdSchema
|
Fields inherited from class org.eclipse.xsd.ecore.MapBuilder |
---|
mapper, xsdComponentToEModelElementMap |
Fields inherited from class org.eclipse.xsd.ecore.NameMangler |
---|
DOMAINS, LOWER_CASE, UNCHANGED_CASE, UPPER_CASE |
Constructor Summary | |
---|---|
EcoreXMLSchemaBuilder()
|
Method Summary | |
---|---|
protected void |
addDocumentation(XSDConcreteComponent xsdComponent,
EModelElement eModelElement)
|
protected void |
addEMFSchema()
|
protected void |
addImport(java.lang.String namespace,
java.lang.String schemaLocation)
|
protected void |
additionalProcessing(EClass cls,
XSDComplexTypeDefinition xsdComplexTypeDefinition)
|
protected void |
createAttributeDeclaration(EAttribute attribute,
XSDComplexTypeDefinition xsdComplexTypeDefinition)
|
protected void |
createAttributeElementDeclaration(EAttribute attribute,
XSDComplexTypeDefinition xsdComplexTypeDefinition)
|
protected void |
createEMFSchema()
|
protected XSDModelGroup |
createModelGroup(XSDComplexTypeDefinition xsdComplexTypeDefinition)
|
protected void |
createOtherSchema(EPackage ePackage)
|
protected void |
createSchema()
|
java.util.Collection<EObject> |
generate(EPackage ePackage)
|
java.util.Collection<EObject> |
generate(EPackage ePackage,
EcoreXMLSchemaBuilder.QNameMap qNameMap)
|
protected java.util.List<EStructuralFeature> |
getAllFeatures(EClass eClass,
java.util.Set<EClass> classesToIgnore)
This method returns the list of features for the given class and all inherited features; ignoring features from classes in the classesToIgnore set. |
protected java.util.List<EStructuralFeature> |
getFeatures(EClass eClass,
java.util.List<EClass> superClasses)
Return the inherited features from the super classes (except the first one, which is the base type for the generated schema type for the class), and the local features. |
protected XSDModelGroup |
getModelGroup(XSDComplexTypeDefinition xsdComplexTypeDefinition)
Returns the model group for the given complex type definition. |
protected java.lang.String |
getName(ENamedElement element)
Return the given name, or the name from the XMLMap, if there is one. |
protected XSDSimpleTypeDefinition |
getType(EDataType dataType)
|
protected java.lang.String |
getUniqueNsPrefix(EPackage ePackage)
|
protected boolean |
makeAttributeDeclaration(EAttribute attribute)
|
protected boolean |
makeAttributeElementDeclaration(EAttribute attribute)
|
protected boolean |
makeClassElementDeclaration(EClass eClass)
|
protected boolean |
makeReferenceAttribute(EReference reference)
|
protected void |
makeReferenceAttribute(EReference reference,
XSDComplexTypeDefinition xsdComplexTypeDefinition)
|
protected boolean |
makeReferenceElement(EReference reference)
|
protected void |
makeReferenceElement(EReference reference,
XSDComplexTypeDefinition xsdComplexTypeDefinition)
|
protected boolean |
processAttribute(EAttribute attribute)
|
protected void |
processAttribute(EAttribute attribute,
XSDComplexTypeDefinition xsdComplexTypeDefinition)
Map each EAttribute to an XML attribute declaration in the complex type corresponding to the class, or an XML element declaration, depending on the multiplicity of the EAttribute. |
protected void |
processClass(EClass eClass)
Map each EClass to a schema complex type and an element declaration of that type; the names of the complex type and element declaration are the name of the class. |
protected void |
processClasses()
|
protected void |
processEnum(EEnum eEnum)
Each EEnum is mapped to a schema simple type that restricts the string simple type; the schema type has an enumeration facet for each EEnumLiteral. |
protected void |
processEnums()
|
protected void |
processReference(EReference reference,
XSDComplexTypeDefinition xsdComplexTypeDefinition)
|
protected void |
setAttributeElementMultiplicity(EAttribute attribute,
XSDParticle particle)
|
protected void |
setAttributeType(EAttribute attribute,
XSDAttributeDeclaration attrDecl)
|
protected void |
setDefaultValue(EAttribute attribute,
XSDAttributeDeclaration attrDecl)
|
protected void |
setReferenceAttribType(XSDAttributeDeclaration xsdAttributeDeclaration)
|
protected void |
setReferenceElementMultiplicity(EReference reference,
XSDParticle particle)
|
protected void |
setReferenceElementType(EReference reference,
XSDElementDeclaration xsdElementDeclaration)
|
protected void |
setUseToRequired(EAttribute attribute,
XSDAttributeUse attrUse)
|
protected boolean |
skipReference(EReference reference)
|
protected XSDTypeDefinition |
typeInOtherSchema(EClassifier classifier)
|
Methods inherited from class org.eclipse.xsd.ecore.MapBuilder |
---|
addInput, addOutput, map, setMapper |
Methods inherited from class org.eclipse.xsd.ecore.NameMangler |
---|
parseName, qualifiedPackageName, uncapName, validName, validName, validName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String OPTION_TO_ENFORCE_LOWERBOUND
public static final java.lang.String OPTION_USE_ENCODED_ATTRIBUTE_STYLE
protected static final java.lang.String EMF_SCHEMA_URI
protected static final java.lang.String EMF_SCHEMA_PREFIX
protected static final java.lang.String EMF_SCHEMA_NAME
protected static final java.lang.String REFERENCE_TYPE_NAME
protected XSDSchema xsdSchema
protected XSDSchema emfSchema
protected EPackage ePackage
protected java.util.Map<java.lang.String,java.lang.String> ecoreToSchemaName
protected java.util.Map<EPackage,XSDSchema> ePackageToXSDSchemaMap
protected java.util.Map<EPackage,java.lang.String> ePackageToNsPrefixMap
protected EcoreXMLSchemaBuilder.QNameMap qNameMap
protected boolean minimizedXMI
protected boolean useEncodedAttributeStyle
protected boolean enforceLowerBound
protected java.util.List<EClass> rootClasses
protected XSDParser xsdParser
Constructor Detail |
---|
public EcoreXMLSchemaBuilder()
Method Detail |
---|
public java.util.Collection<EObject> generate(EPackage ePackage)
public java.util.Collection<EObject> generate(EPackage ePackage, EcoreXMLSchemaBuilder.QNameMap qNameMap)
protected java.lang.String getUniqueNsPrefix(EPackage ePackage)
protected void createSchema()
protected void createEMFSchema()
protected void addEMFSchema()
protected XSDTypeDefinition typeInOtherSchema(EClassifier classifier)
protected void addImport(java.lang.String namespace, java.lang.String schemaLocation)
protected void createOtherSchema(EPackage ePackage)
protected void processClasses()
protected void processEnums()
protected java.lang.String getName(ENamedElement element)
protected void processEnum(EEnum eEnum)
protected void processClass(EClass eClass)
protected boolean makeClassElementDeclaration(EClass eClass)
protected void additionalProcessing(EClass cls, XSDComplexTypeDefinition xsdComplexTypeDefinition)
protected java.util.List<EStructuralFeature> getFeatures(EClass eClass, java.util.List<EClass> superClasses)
protected java.util.List<EStructuralFeature> getAllFeatures(EClass eClass, java.util.Set<EClass> classesToIgnore)
protected void processAttribute(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition)
The types are mapped as follows: Ecore type Schema type ------------ ------------- EBoolean boolean EBooleanObject boolean EInt int EIntegerObject int ELong long ELongObject long EFloat float EFloatObject float EDouble double EDoubleObject double EString string
If the attribute has no type or if the type is an EDataType that is not an EEnum, the schema string type is used.
If the EAttribute is required, the attribute declaration includes use="required".
If the EAttribute has a defaultValueLiteral, the attribute declaration has a default attribute whose value is the defaultValueLiteral.
If the EAttribute is transient, or its type is not serializable, an attribute declaration is not generated.
If the EAttribute can have many values, an element declaration is created rather than an attribute declaration. The lower bound of the attribute is set to the minOccurs value of the element declaration. The upper bound of the attribute is set to the maxOccurs value of the element declaration (converting -1 to unbounded as appropriate). The type of the element is set as above for attribute declarations.
protected void createAttributeDeclaration(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition)
protected void createAttributeElementDeclaration(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition)
protected void setAttributeElementMultiplicity(EAttribute attribute, XSDParticle particle)
protected boolean processAttribute(EAttribute attribute)
protected boolean makeAttributeDeclaration(EAttribute attribute)
protected boolean makeAttributeElementDeclaration(EAttribute attribute)
protected XSDModelGroup getModelGroup(XSDComplexTypeDefinition xsdComplexTypeDefinition)
protected XSDModelGroup createModelGroup(XSDComplexTypeDefinition xsdComplexTypeDefinition)
protected void setAttributeType(EAttribute attribute, XSDAttributeDeclaration attrDecl)
protected void setUseToRequired(EAttribute attribute, XSDAttributeUse attrUse)
protected void setDefaultValue(EAttribute attribute, XSDAttributeDeclaration attrDecl)
protected void processReference(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition)
protected boolean makeReferenceAttribute(EReference reference)
protected boolean makeReferenceElement(EReference reference)
protected boolean skipReference(EReference reference)
protected void makeReferenceAttribute(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition)
protected void setReferenceAttribType(XSDAttributeDeclaration xsdAttributeDeclaration)
protected void makeReferenceElement(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition)
protected void setReferenceElementType(EReference reference, XSDElementDeclaration xsdElementDeclaration)
protected void setReferenceElementMultiplicity(EReference reference, XSDParticle particle)
protected XSDSimpleTypeDefinition getType(EDataType dataType)
protected void addDocumentation(XSDConcreteComponent xsdComponent, EModelElement eModelElement)
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |