Version: 1.1.1

org.biomoby.shared.schema
Class Builder

java.lang.Object
  extended by org.biomoby.shared.schema.Builder

public class Builder
extends Object


Field Summary
static org.jdom.Namespace namespace
           
 
Constructor Summary
Builder()
           
 
Method Summary
 void addArticleNameType(org.jdom.Element roots, String types, Vector articles)
          Given a vector containing possible article names and type name, add an XML Schema element to describe the restriction.
 void addDescriptNote(String str, org.jdom.Element parent)
          add description or comment element to the element parent.
 void addPrimitiveComplexType(org.jdom.Element parent, String name, String base)
          add a complexType for string to the root element; Element parent is the root Element.
 void addPrimitiveElement(PrimitiveVector pri, org.jdom.Element element)
          add all primitive element to the sequnece element.
 void addPrimitiveSimpleType(org.jdom.Element parent, Vector vc, String name)
          add simpleType for the primitive element; create a enumeration XML schema element for article names.
 void addUniqueElement(org.jdom.Element parent, String name, Vector strV)
          add an unique element as a child of an element parent.
 org.jdom.Element buildMobyEncapsulatedSchema(String name)
           
 org.jdom.Element buildSchema(String name)
          Given a string, we will give a element represnting an xml schema which describe the object of the name.
 org.jdom.Element getArticleName(String article)
          create an xml schema element for article name attribute of a moby object
 org.jdom.Element getComplexType(MElement m, String typeName)
          create a complexType XML schema element for MElement which does not have has or hasa relation with other MElement
 org.jdom.Element getComplexTypeRec(MElement m, String typeName, Vector vc1)
          recursively get a complexType XML Shema element for MElement; when this MElement does not have has and hasa relation, we use another method called getComplexType;
static String getDate()
          get the date of current time
 void getElement(MElement m)
          the input is a MElement object; we will find all its hasa and has relations with other object; then modify the root element of the output xml file; the root element is the root element of a xml schema xml file.
 void getFirstLevel(MElement m, org.jdom.Element rt)
          create the top level of xml schema element for a moby object.
 org.jdom.Element getIDAttribute()
          create an xml schema element for ID attribute 0f a moby object.
 org.jdom.Element getNamespaceAttribute()
          create an xml schema element for namescape attribute of the moby element.
 org.jdom.Element getRestrictionArticleName(Vector vc)
          create an xml schema element for articleName attribute if the values of the articleName can have multiple choices.
static org.jdom.Element getRoot(String str)
          create a root element for the schema to begin.
static void main(String[] args)
           
 void set3Attributes(MElement m, org.jdom.Element types, Vector ar)
          Add ID, namespace and article attributes elements into Element types; every moby object has these three attributes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

namespace

public static org.jdom.Namespace namespace
Constructor Detail

Builder

public Builder()
Method Detail

buildSchema

public org.jdom.Element buildSchema(String name)
Given a string, we will give a element represnting an xml schema which describe the object of the name.

Parameters:
name - the name of object
Returns:
XML Element which represents an XML Schema

buildMobyEncapsulatedSchema

public org.jdom.Element buildMobyEncapsulatedSchema(String name)
Parameters:
name - the name of the Moby data type that a complete moby message schema document will be created for
Returns:
a jDom element object that contains the schema for the moby data type 'name' or null if no valid data type exists

getElement

public void getElement(MElement m)
the input is a MElement object; we will find all its hasa and has relations with other object; then modify the root element of the output xml file; the root element is the root element of a xml schema xml file.

Parameters:
m - a MElement

addArticleNameType

public void addArticleNameType(org.jdom.Element roots,
                               String types,
                               Vector articles)
Given a vector containing possible article names and type name, add an XML Schema element to describe the restriction.

Parameters:
roots - the root element of the XML Schema
types - the name of XML Schema simpleType
articles - a vector containing different article names

set3Attributes

public void set3Attributes(MElement m,
                           org.jdom.Element types,
                           Vector ar)
Add ID, namespace and article attributes elements into Element types; every moby object has these three attributes.

Parameters:
m - a MElement
types - the type of MElement; there is a field in MElement
ar - a vector containing all possible article names for this MElement

getFirstLevel

public void getFirstLevel(MElement m,
                          org.jdom.Element rt)
create the top level of xml schema element for a moby object.

Parameters:
m - a MElement
rt - a xML Schema root element

getComplexTypeRec

public org.jdom.Element getComplexTypeRec(MElement m,
                                          String typeName,
                                          Vector vc1)
recursively get a complexType XML Shema element for MElement; when this MElement does not have has and hasa relation, we use another method called getComplexType;

Parameters:
m - a MElement object
typeName - the name of complexType
vc1 - a vector containing all possible article names for the MElement
Returns:
the complexType element for this MElement object

getComplexType

public org.jdom.Element getComplexType(MElement m,
                                       String typeName)
create a complexType XML schema element for MElement which does not have has or hasa relation with other MElement

Parameters:
m - a MElement
typeName - the name of the complexType
Returns:
a complexType XML schema element

getNamespaceAttribute

public org.jdom.Element getNamespaceAttribute()
create an xml schema element for namescape attribute of the moby element.

Returns:
an xml schema element for namespace attribute

getIDAttribute

public org.jdom.Element getIDAttribute()
create an xml schema element for ID attribute 0f a moby object.

Returns:
an xml schema element for ID attribute

getArticleName

public org.jdom.Element getArticleName(String article)
create an xml schema element for article name attribute of a moby object

Parameters:
article - value of the article attribute
Returns:
an xml schema element for articleName attribute

getRestrictionArticleName

public org.jdom.Element getRestrictionArticleName(Vector vc)
create an xml schema element for articleName attribute if the values of the articleName can have multiple choices.

Parameters:
vc - a vector containing possible values of articleName attribute
Returns:
an xml schema elment for articleName attribute

getRoot

public static org.jdom.Element getRoot(String str)
create a root element for the schema to begin.

Parameters:
str -
Returns:
an root element of XML schema

addDescriptNote

public void addDescriptNote(String str,
                            org.jdom.Element parent)
add description or comment element to the element parent.

Parameters:
str - the description of an element
parent - the element which we wnat to give a description

getDate

public static String getDate()
get the date of current time

Returns:
a string representing current time

addPrimitiveElement

public void addPrimitiveElement(PrimitiveVector pri,
                                org.jdom.Element element)
add all primitive element to the sequnece element.

Parameters:
pri - a PrimitiveVector object
element - a XML Schema element

addUniqueElement

public void addUniqueElement(org.jdom.Element parent,
                             String name,
                             Vector strV)
add an unique element as a child of an element parent.

Parameters:
parent - the parent element of unique element
name - the name of the unique element
strV - a Vector containing the name of MElement in a hasa Vector

addPrimitiveComplexType

public void addPrimitiveComplexType(org.jdom.Element parent,
                                    String name,
                                    String base)
add a complexType for string to the root element; Element parent is the root Element.

Parameters:
parent - the parent element of this complexTpe element which is a root element here
name - the complexType name
base - the base we will extend

addPrimitiveSimpleType

public void addPrimitiveSimpleType(org.jdom.Element parent,
                                   Vector vc,
                                   String name)
add simpleType for the primitive element; create a enumeration XML schema element for article names.

Parameters:
parent - the root element
vc - a vector containing article names
name - the name of this simpleType

main

public static void main(String[] args)
Parameters:
args - the string array containing the arguments for this main method

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010