kaos.xmlschema.util
Class XMLSchemaBuilderImpl

java.lang.Object
  extended by kaos.xmlschema.util.XMLSchemaBuilderImpl
All Implemented Interfaces:
java.io.Serializable, KAoSInstanceDescription, XMLSchemaBuilder

public class XMLSchemaBuilderImpl
extends java.lang.Object
implements XMLSchemaBuilder, java.io.Serializable

See Also:
Serialized Form

Constructor Summary
XMLSchemaBuilderImpl()
           
XMLSchemaBuilderImpl(XSDatatype baseType)
           
 
Method Summary
 java.lang.String convertToSchema()
          convert this data type to its xml schema definition.
 void deriveDataType(java.lang.String nameSpace, java.lang.String localName)
          derive this data type from its parent and from the restrictions set on it.
 XSDatatype getBaseDataType()
           
 java.lang.String getBaseDataTypeName()
          get the name of the parent data type of this type.
 java.lang.String getCurrentDataTypeName()
          get the name of this data type.
 java.util.Vector getCurrentRestrictionNames()
          get the names of al restrictions that are set on this data type.
 java.lang.String getDataCurrentType()
           
 java.lang.String getRestrictionValue(java.lang.String restrictionName)
          get the value of the given restriction.
 boolean isValid(java.lang.String value)
          check if the given value is allowed by the restrictions in this schema.
 void readFromSchema(java.util.Vector types)
          create this data type by reading schema its definitions.
 void setBaseDataType(java.lang.String baseTypeName)
           
 void setCurrentDataType(XSDatatype currentType)
           
 void setRestrictionValue(java.lang.String restrictionName, java.lang.String value)
          set the given restriction with its value on this data type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLSchemaBuilderImpl

public XMLSchemaBuilderImpl()

XMLSchemaBuilderImpl

public XMLSchemaBuilderImpl(XSDatatype baseType)
Method Detail

setCurrentDataType

public void setCurrentDataType(XSDatatype currentType)

setBaseDataType

public void setBaseDataType(java.lang.String baseTypeName)
                     throws DatatypeException
Throws:
DatatypeException

getBaseDataType

public XSDatatype getBaseDataType()

getBaseDataTypeName

public java.lang.String getBaseDataTypeName()
get the name of the parent data type of this type.

Specified by:
getBaseDataTypeName in interface XMLSchemaBuilder
Returns:
the name of the parent data type. Null if not set.

getCurrentDataTypeName

public java.lang.String getCurrentDataTypeName()
get the name of this data type.

Specified by:
getCurrentDataTypeName in interface XMLSchemaBuilder
Returns:
the name of this data type. Null if not set.

getDataCurrentType

public java.lang.String getDataCurrentType()

deriveDataType

public void deriveDataType(java.lang.String nameSpace,
                           java.lang.String localName)
                    throws DatatypeException
derive this data type from its parent and from the restrictions set on it. NOTE: THIS METHOD MUST BE CALLED *AFTER* THE RESTRICTIONS ARE SET. THE CHECK FOR VALID VALUES WON'T WORK OTHERWISE!!!

Specified by:
deriveDataType in interface XMLSchemaBuilder
Parameters:
nameSpace - the name space of the data type.
localName - the name of this data type.
Throws:
DatatypeException

setRestrictionValue

public void setRestrictionValue(java.lang.String restrictionName,
                                java.lang.String value)
                         throws DatatypeException
set the given restriction with its value on this data type.

Specified by:
setRestrictionValue in interface XMLSchemaBuilder
Parameters:
restrictionNamet - the name of restriction (e.g. minLength).
value - the value of that restriction.
Throws:
DatatypeException

getRestrictionValue

public java.lang.String getRestrictionValue(java.lang.String restrictionName)
get the value of the given restriction.

Specified by:
getRestrictionValue in interface XMLSchemaBuilder
Parameters:
restrictionNamet - the name of restriction (e.g. minLength).
Returns:
the value of the restriction. Null if not set.

getCurrentRestrictionNames

public java.util.Vector getCurrentRestrictionNames()
get the names of al restrictions that are set on this data type.

Specified by:
getCurrentRestrictionNames in interface XMLSchemaBuilder
Returns:
a vector containing names of all these restrictions.

isValid

public boolean isValid(java.lang.String value)
check if the given value is allowed by the restrictions in this schema.

Specified by:
isValid in interface XMLSchemaBuilder
Parameters:
value - the value to be checked.
Returns:
true is allowed, false if not.

convertToSchema

public java.lang.String convertToSchema()
convert this data type to its xml schema definition.

Specified by:
convertToSchema in interface XMLSchemaBuilder
Returns:
a String containing this schema definition.

readFromSchema

public void readFromSchema(java.util.Vector types)
                    throws DatatypeException
create this data type by reading schema its definitions. Note that a data type can inherit from a chain of parent data types.

Specified by:
readFromSchema in interface XMLSchemaBuilder
Parameters:
types - a Vector containing xml definitions for this and its parent data types.
Throws:
DatatypeException