com.evolveum.midpoint.schema.processor
Class Schema

java.lang.Object
  extended by com.evolveum.midpoint.schema.processor.Schema
All Implemented Interfaces:
Dumpable, java.io.Serializable

public class Schema
extends java.lang.Object
implements Dumpable, java.io.Serializable

Schema as a collection of definitions. This is a midPoint-specific view of schema definition. It is just a collection of definitions grouped under a specific namespace. The schema and all the public classes in this package define a schema meta-model. It is supposed to be used for run-time schema interpretation. It will not be a convenient tool to work with static data model objects such as user or role. But it is needed for interpreting dynamic schemas for resource objects, extensions and so on. Schema is immutable.

Author:
Radovan Semancik
See Also:
Serialized Form

Constructor Summary
Schema(java.lang.String namespace)
           
 
Method Summary
 PropertyContainerDefinition createPropertyContainerDefinition(java.lang.String localTypeName)
          Creates a new property container definition and adds it to the schema.
 PropertyDefinition createPropertyDefinition(javax.xml.namespace.QName name, javax.xml.namespace.QName typeName)
          Creates a top-level property definition and adds it to the schema.
 PropertyDefinition createPropertyDefinition(java.lang.String localName, javax.xml.namespace.QName typeName)
          Creates a top-level property definition and adds it to the schema.
 PropertyDefinition createPropertyDefinition(java.lang.String localName, java.lang.String localTypeName)
          Creates a top-level property definition and adds it to the schema.
 ResourceObjectDefinition createResourceObjectDefinition(javax.xml.namespace.QName typeName)
          Creates a new resource object definition and adds it to the schema.
 ResourceObjectDefinition createResourceObjectDefinition(java.lang.String localTypeName)
          Creates a new resource object definition and adds it to the schema.
 java.lang.String dump()
          Show the content of the object intended for diagnostics by developer.
 ResourceObjectDefinition findAccountDefinition()
          Looks for a default account ObjectClass.
 ResourceObjectDefinition findAccountDefinition(java.lang.String accountType)
          Looks for a specific account ObjectClass.
 ComplexTypeDefinition findComplexTypeDefinition(javax.xml.namespace.QName typeName)
          Finds complex type definition by type name.
 PropertyContainerDefinition findContainerDefinitionByType(javax.xml.namespace.QName typeName)
          Finds a PropertyContainerDefinition by the type name.
<T extends ItemDefinition>
T
findItemDefinition(javax.xml.namespace.QName definitionName, java.lang.Class<T> definitionType)
          Finds item definition by name.
<T extends ItemDefinition>
T
findItemDefinition(java.lang.String localName, java.lang.Class<T> definitionType)
          Finds item definition by local name
 java.util.Set<Definition> getDefinitions()
          Returns set of definitions.
 java.lang.String getNamespace()
          Returns schema namespace.
 boolean isEmpty()
           
static Schema parse(org.w3c.dom.Element schema)
           
 PropertyContainer parsePropertyContainer(org.w3c.dom.Element domElement)
           
 org.w3c.dom.Document serializeToXsd()
           
static org.w3c.dom.Document serializeToXsd(Schema schema)
           
 void updateSchemaAccess(SchemaHandlingType schemaHandling)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Schema

public Schema(java.lang.String namespace)
Method Detail

getNamespace

public java.lang.String getNamespace()
Returns schema namespace. All schema definitions are placed in the returned namespace.

Returns:
schema namespace

getDefinitions

public java.util.Set<Definition> getDefinitions()
Returns set of definitions. The set contains all definitions of all types that were parsed. Order of definitions is insignificant.

Returns:
set of definitions

parse

public static Schema parse(org.w3c.dom.Element schema)
                    throws SchemaException
Throws:
SchemaException

serializeToXsd

public org.w3c.dom.Document serializeToXsd()
                                    throws SchemaException
Throws:
SchemaException

serializeToXsd

public static org.w3c.dom.Document serializeToXsd(Schema schema)
                                           throws SchemaException
Throws:
SchemaException

parsePropertyContainer

public PropertyContainer parsePropertyContainer(org.w3c.dom.Element domElement)
                                         throws SchemaException
Throws:
SchemaException

updateSchemaAccess

public void updateSchemaAccess(SchemaHandlingType schemaHandling)

findContainerDefinitionByType

public PropertyContainerDefinition findContainerDefinitionByType(javax.xml.namespace.QName typeName)
Finds a PropertyContainerDefinition by the type name.

Parameters:
typeName - property container type name
Returns:
found property container definition
Throws:
java.lang.IllegalStateException - if more than one definition is found

findComplexTypeDefinition

public ComplexTypeDefinition findComplexTypeDefinition(javax.xml.namespace.QName typeName)
Finds complex type definition by type name.


findItemDefinition

public <T extends ItemDefinition> T findItemDefinition(javax.xml.namespace.QName definitionName,
                                                       java.lang.Class<T> definitionType)
Finds item definition by name.


findItemDefinition

public <T extends ItemDefinition> T findItemDefinition(java.lang.String localName,
                                                       java.lang.Class<T> definitionType)
Finds item definition by local name


dump

public java.lang.String dump()
Description copied from interface: Dumpable
Show the content of the object intended for diagnostics by developer. The content may be multi-line, in case of hierarchical objects it may be intended. The use of this method may not be efficient. It is not supposed to be used in normal operation. However, it is very useful in tests or in case of dumping objects in severe error situations.

Specified by:
dump in interface Dumpable
Returns:
content of the object intended for diagnostics.

isEmpty

public boolean isEmpty()

createPropertyContainerDefinition

public PropertyContainerDefinition createPropertyContainerDefinition(java.lang.String localTypeName)
Creates a new property container definition and adds it to the schema. This is a preferred way how to create definition in the schema.

Parameters:
localTypeName - type name "relative" to schema namespace
Returns:
new property container definition

createResourceObjectDefinition

public ResourceObjectDefinition createResourceObjectDefinition(java.lang.String localTypeName)
Creates a new resource object definition and adds it to the schema. This is a preferred way how to create definition in the schema.

Parameters:
localTypeName - type name "relative" to schema namespace
Returns:
new resource object definition

createResourceObjectDefinition

public ResourceObjectDefinition createResourceObjectDefinition(javax.xml.namespace.QName typeName)
Creates a new resource object definition and adds it to the schema. This is a preferred way how to create definition in the schema.

Parameters:
localTypeName - type QName
Returns:
new resource object definition

createPropertyDefinition

public PropertyDefinition createPropertyDefinition(java.lang.String localName,
                                                   javax.xml.namespace.QName typeName)
Creates a top-level property definition and adds it to the schema. This is a preferred way how to create definition in the schema.

Parameters:
localName - element name "relative" to schema namespace
typeName - XSD type name of the element
Returns:
new property definition

createPropertyDefinition

public PropertyDefinition createPropertyDefinition(java.lang.String localName,
                                                   java.lang.String localTypeName)
Creates a top-level property definition and adds it to the schema. This is a preferred way how to create definition in the schema.

Parameters:
localName - element name "relative" to schema namespace
localTypeName - XSD type name "relative" to schema namespace
Returns:
new property definition

createPropertyDefinition

public PropertyDefinition createPropertyDefinition(javax.xml.namespace.QName name,
                                                   javax.xml.namespace.QName typeName)
Creates a top-level property definition and adds it to the schema. This is a preferred way how to create definition in the schema.

Parameters:
localName - element name
typeName - XSD type name of the element
Returns:
new property definition

findAccountDefinition

public ResourceObjectDefinition findAccountDefinition()
Looks for a default account ObjectClass.


findAccountDefinition

public ResourceObjectDefinition findAccountDefinition(java.lang.String accountType)
Looks for a specific account ObjectClass.



Copyright © 2011 evolveum. All Rights Reserved.