Package com.evolveum.midpoint.prism.impl
Class PrismContextImpl
java.lang.Object
com.evolveum.midpoint.prism.impl.PrismContextImpl
- All Implemented Interfaces:
ProtectorCreator
,PrismContext
- Author:
- semancik
-
Field Summary
Fields inherited from interface com.evolveum.midpoint.prism.PrismContext
LANG_JSON, LANG_XML, LANG_YAML
-
Method Summary
Modifier and TypeMethodDescriptionvoid
adopt
(Containerable containerable) <T extends Objectable>
voidadopt
(ObjectDelta<T> delta) void
adopt
(Objectable objectable) <C extends Containerable>
voidadopt
(PrismContainer<C> container) <C extends Containerable>
voidadopt
(PrismContainer<C> container, Class<C> declaredType) Set up the specified object with prism context instance and schema definition.void
adopt
(PrismContainerValue<?> value) <C extends Containerable,
O extends Objectable>
voidadopt
(PrismContainerValue<C> prismContainerValue, Class<O> type, ItemPath path) <C extends Containerable>
voidadopt
(PrismContainerValue<C> prismContainerValue, QName typeName, ItemPath path) <C extends Containerable,
O extends Objectable>
voidvoid
static PrismContextImpl
create
(@NotNull SchemaRegistryImpl schemaRegistry) createCanonicalItemPath
(ItemPath itemPath) TemporarycreateCanonicalItemPath
(ItemPath itemPath, QName objectType) Temporary@NotNull PolyStringNormalizer
Creates a configured poly string normalizer for the use by the client.static PrismContextImpl
createEmptyContext
(@NotNull SchemaRegistryImpl schemaRegistry) Creates initialized KeyStoreBasedProtector according to configured KeyStoreBasedProtectorBuilder object.<O extends Objectable>
@NotNull PrismObject<O>createKnownObject
(@NotNull Class<O> clazz) Creates a new PrismObject of a given static type.<O extends Objectable>
OcreateKnownObjectable
(@NotNull Class<O> clazz) Creates a new Objectable of a given static type.<T extends Objectable>
@NotNull PrismObject<T>createObject
(@NotNull Class<T> clazz) Creates a new PrismObject of a given type.<T extends Objectable>
TcreateObjectable
(@NotNull Class<T> clazz) Creates a new Objectable of a given type.Creates uninitialized KeyStoreBasedProtector according to configured KeyStoreBasedProtectorBuilder object.createQueryParser
(Map<String, String> prefixToNamespace) @NotNull DefinitionFactory
@NotNull DeltaFactory
Access point to the "old" way of creating deltas.<C extends Containerable>
S_ItemEntryStarts a delta builder, with the default item definition resolution (i.e.<C extends Containerable>
S_ItemEntrydeltaFor
(Class<C> objectClass, ItemDefinitionResolver itemDefinitionResolver) Starts a delta builder, with a custom item definition resolver (e.g.@NotNull String
detectLanguage
(@NotNull File file) @NotNull PrismSerializer<Element>
Creates a serializer for DOM.@NotNull BeanMarshaller
WARNING! This is not really public method.@NotNull BeanUnmarshaller
@NotNull PolyStringNormalizer
Returns the default PolyString normalizer.Returns the default protector.Define default reference target type for cases, when missing it in schema for reference item.Type name for serialization of Referencable that's not of XML type (e.g.If defined, it is considered to be the same as the relation of 'null'.@NotNull SchemaDefinitionFactory
@NotNull JaxbDomHack
@NotNull LexicalProcessorRegistry
If defined, marks the 'multiple objects' element.WARNING! This is not really public method.@NotNull PrismMarshaller
@NotNull PrismUnmarshaller
WARNING! This is not really public method.@NotNull QueryConverter
@NotNull SchemaRegistry
Returns the schema registry.hacks()
void
Initializes the prism context, e.g.boolean
isDefaultRelation
(QName relation) static boolean
@NotNull ItemFactory
@NotNull ItemPathParser
@NotNull ItemPathSerializer
@NotNull PrismSerializer<String>
Creates a serializer for JSON language.@NotNull PrismParserNoIO
Creates a parser ready to process data from the given XNode tree.@NotNull PrismParser
Creates a parser ready to process the given file.@NotNull PrismParser
parserFor
(@NotNull InputStream stream) Creates a parser ready to process data from the given input stream.@NotNull PrismParserNoIO
Creates a parser ready to process data from the given string.@NotNull PrismParserNoIO
Creates a parser ready to process data from the given DOM element.@NotNull QueryFactory
Access point to the "old" way of creating queries, filters and paging instructions.queryFor
(Class<? extends Containerable> type) Starts a query builder with the goal of creating a query targeted at given object or container type.queryFor
(Class<? extends Containerable> type, ItemDefinitionResolver itemDefinitionResolver) Starts a query builder, with a custom item definition resolver (e.g.queryForReferenceOwnedBy
(Class<? extends Containerable> ownerClass, ItemPath referencePath) Starts a query builder for reference search, with the default item definition resolution (i.e.void
void
boolean
relationMatches
(@NotNull List<QName> relationQuery, QName relation) Returns true of any of the relation in the relationQuery list matches specified relation.boolean
relationMatches
(QName relationQuery, QName relation) boolean
relationsEquivalent
(QName relation1, QName relation2) @NotNull SchemaFactory
@NotNull PrismSerializer<String>
serializerFor
(@NotNull String language) Creates a serializer for the given language.void
setDefaultProtector
(Protector defaultProtector) void
setDefaultReferenceTargetType
(QName defaultTargetType) void
setDefaultReferenceTypeName
(QName defaultReferenceTypeName) void
setDefaultRelation
(QName defaultRelation) void
setDefinitionFactory
(SchemaDefinitionFactory schemaDefinitionFactory) void
setExtensionContainerTypeName
(QName typeName) void
setExtraValidation
(boolean value) void
setMonitor
(PrismMonitor monitor) void
setObjectsElementName
(QName objectsElementName) void
setParsingMigrator
(ParsingMigrator parsingMigrator) void
setProvenanceEquivalenceStrategy
(EquivalenceStrategy provenanceEquivalenceStrategy) void
setValueMetadataFactory
(ValueMetadataFactory valueMetadataFactory) @NotNull UniformItemPath
toUniformPath
(ItemPath path) TemporarytoUniformPath
(ItemPathType path) valueBasedDefinitionLookupsForType
(QName typeName) @NotNull PrismSerializer<String>
Creates a serializer for XML language.@NotNull PrismSerializer<RootXNode>
Creates a serializer for XNode.@NotNull PrismSerializer<String>
Creates a serializer for YAML language.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.evolveum.midpoint.prism.PrismContext
createQueryParser, parseObject, parseObject, toPath
-
Method Details
-
create
-
createEmptyContext
public static PrismContextImpl createEmptyContext(@NotNull @NotNull SchemaRegistryImpl schemaRegistry) -
initialize
Description copied from interface:PrismContext
Initializes the prism context, e.g. loads and parses all the schemas.- Specified by:
initialize
in interfacePrismContext
- Throws:
SchemaException
SAXException
IOException
-
configurePolyStringNormalizer
public void configurePolyStringNormalizer(PolyStringNormalizerConfigurationType configuration) throws ClassNotFoundException, InstantiationException, IllegalAccessException - Specified by:
configurePolyStringNormalizer
in interfacePrismContext
- Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
-
createConfiguredPolyStringNormalizer
@NotNull public @NotNull PolyStringNormalizer createConfiguredPolyStringNormalizer(PolyStringNormalizerConfigurationType configuration) throws InstantiationException, IllegalAccessException, ClassNotFoundException Description copied from interface:PrismContext
Creates a configured poly string normalizer for the use by the client. Does not set anything inPrismContext
.- Specified by:
createConfiguredPolyStringNormalizer
in interfacePrismContext
- Throws:
InstantiationException
IllegalAccessException
ClassNotFoundException
-
isExtraValidation
public static boolean isExtraValidation() -
getEntityResolver
-
getSchemaRegistry
Description copied from interface:PrismContext
Returns the schema registry.- Specified by:
getSchemaRegistry
in interfacePrismContext
-
getPrismUnmarshaller
WARNING! This is not really public method. It should NOT be used outside the prism implementation. -
getPrismMarshaller
-
getParserDom
WARNING! This is not really public method. It should NOT be used outside the prism implementation. -
getBeanMarshaller
WARNING! This is not really public method. It should NOT be used outside the prism implementation. -
getBeanUnmarshaller
-
getJaxbDomHack
-
getDefinitionFactory
-
setDefinitionFactory
-
getDefaultPolyStringNormalizer
Description copied from interface:PrismContext
Returns the default PolyString normalizer.- Specified by:
getDefaultPolyStringNormalizer
in interfacePrismContext
-
getDefaultProtector
Description copied from interface:PrismContext
Returns the default protector.- Specified by:
getDefaultProtector
in interfacePrismContext
-
setDefaultProtector
-
getQueryConverter
- Specified by:
getQueryConverter
in interfacePrismContext
-
getMonitor
- Specified by:
getMonitor
in interfacePrismContext
-
setMonitor
- Specified by:
setMonitor
in interfacePrismContext
-
getDefaultRelation
Description copied from interface:PrismContext
If defined, it is considered to be the same as the relation of 'null'. Currently in midPoint, it is the value of org:default.- Specified by:
getDefaultRelation
in interfacePrismContext
-
setDefaultRelation
- Specified by:
setDefaultRelation
in interfacePrismContext
-
setDefaultReferenceTargetType
-
getDefaultReferenceTargetType
Description copied from interface:PrismContext
Define default reference target type for cases, when missing it in schema for reference item.- Specified by:
getDefaultReferenceTargetType
in interfacePrismContext
-
getObjectsElementName
Description copied from interface:PrismContext
If defined, marks the 'multiple objects' element.- Specified by:
getObjectsElementName
in interfacePrismContext
-
setObjectsElementName
-
getDefaultReferenceTypeName
Description copied from interface:PrismContext
Type name for serialization of Referencable that's not of XML type (e.g. DefaultReferencableImpl). In midPoint it's c:ObjectReferenceType.VERY EXPERIMENTAL. Maybe we should simply use t:ObjectReferenceType in such cases.
- Specified by:
getDefaultReferenceTypeName
in interfacePrismContext
-
setDefaultReferenceTypeName
-
getExtensionContainerTypeName
- Specified by:
getExtensionContainerTypeName
in interfacePrismContext
- Returns:
- Name of the generic type for object/container extension (e.g. c:ExtensionType).
-
setExtensionContainerTypeName
- Specified by:
setExtensionContainerTypeName
in interfacePrismContext
-
parserFor
Description copied from interface:PrismContext
Creates a parser ready to process the given file.- Specified by:
parserFor
in interfacePrismContext
- Parameters:
file
- File to be parsed.- Returns:
- Parser that can be invoked to retrieve the (parsed) content of the file.
-
parserFor
Description copied from interface:PrismContext
Creates a parser ready to process data from the given input stream.- Specified by:
parserFor
in interfacePrismContext
- Parameters:
stream
- Input stream to be parsed.- Returns:
- Parser that can be invoked to retrieve the (parsed) content of the input stream.
-
parserFor
Description copied from interface:PrismContext
Creates a parser ready to process data from the given string. Format/language of the data will be auto-detected, so the typically followingPrismParser.language(String)
can be omitted.- Specified by:
parserFor
in interfacePrismContext
- Parameters:
data
- String with the data to be parsed.- Returns:
- Parser that can be invoked to retrieve the (parsed) content.
-
parserFor
Description copied from interface:PrismContext
Creates a parser ready to process data from the given XNode tree.- Specified by:
parserFor
in interfacePrismContext
- Parameters:
xnode
- XNode tree with the data to be parsed.- Returns:
- Parser that can be invoked to retrieve the (parsed) content.
-
parserFor
Description copied from interface:PrismContext
Creates a parser ready to process data from the given DOM element.- Specified by:
parserFor
in interfacePrismContext
- Parameters:
data
- Element with the data to be parsed.- Returns:
- Parser that can be invoked to retrieve the (parsed) content.
-
detectLanguage
- Specified by:
detectLanguage
in interfacePrismContext
- Throws:
IOException
-
getParsingMigrator
- Specified by:
getParsingMigrator
in interfacePrismContext
-
setParsingMigrator
- Specified by:
setParsingMigrator
in interfacePrismContext
-
adopt
public <C extends Containerable> void adopt(PrismContainer<C> container, Class<C> declaredType) throws SchemaException Set up the specified object with prism context instance and schema definition.- Specified by:
adopt
in interfacePrismContext
- Throws:
SchemaException
-
adopt
- Specified by:
adopt
in interfacePrismContext
- Throws:
SchemaException
-
adopt
- Specified by:
adopt
in interfacePrismContext
- Throws:
SchemaException
-
adopt
- Specified by:
adopt
in interfacePrismContext
- Throws:
SchemaException
-
adopt
- Specified by:
adopt
in interfacePrismContext
- Throws:
SchemaException
-
adopt
- Specified by:
adopt
in interfacePrismContext
- Throws:
SchemaException
-
adopt
public <C extends Containerable,O extends Objectable> void adopt(C containerable, Class<O> type, ItemPath path) throws SchemaException - Specified by:
adopt
in interfacePrismContext
- Throws:
SchemaException
-
adopt
public <C extends Containerable,O extends Objectable> void adopt(PrismContainerValue<C> prismContainerValue, Class<O> type, ItemPath path) throws SchemaException - Specified by:
adopt
in interfacePrismContext
- Throws:
SchemaException
-
adopt
public <C extends Containerable> void adopt(PrismContainerValue<C> prismContainerValue, QName typeName, ItemPath path) throws SchemaException - Specified by:
adopt
in interfacePrismContext
- Throws:
SchemaException
-
serializerFor
Description copied from interface:PrismContext
Creates a serializer for the given language.- Specified by:
serializerFor
in interfacePrismContext
- Parameters:
language
- Language (like xml, json, yaml).- Returns:
- The serializer.
-
xmlSerializer
Description copied from interface:PrismContext
Creates a serializer for XML language.- Specified by:
xmlSerializer
in interfacePrismContext
- Returns:
- The serializer.
-
jsonSerializer
Description copied from interface:PrismContext
Creates a serializer for JSON language.- Specified by:
jsonSerializer
in interfacePrismContext
- Returns:
- The serializer.
-
yamlSerializer
Description copied from interface:PrismContext
Creates a serializer for YAML language.- Specified by:
yamlSerializer
in interfacePrismContext
- Returns:
- The serializer.
-
domSerializer
Description copied from interface:PrismContext
Creates a serializer for DOM. The difference from XML serializer is that XML produces String output whereas this one produces a DOM Element.- Specified by:
domSerializer
in interfacePrismContext
- Returns:
- The serializer.
-
xnodeSerializer
Description copied from interface:PrismContext
Creates a serializer for XNode. The output of this serializer is intermediate XNode representation.- Specified by:
xnodeSerializer
in interfacePrismContext
- Returns:
- The serializer.
-
createObject
@NotNull public <T extends Objectable> @NotNull PrismObject<T> createObject(@NotNull @NotNull Class<T> clazz) throws SchemaException Description copied from interface:PrismContext
Creates a new PrismObject of a given type.- Specified by:
createObject
in interfacePrismContext
- Parameters:
clazz
- Static type of the object to be created.- Returns:
- New PrismObject.
- Throws:
SchemaException
- If a definition for the given class couldn't be found.
-
createObjectable
@NotNull public <T extends Objectable> T createObjectable(@NotNull @NotNull Class<T> clazz) throws SchemaException Description copied from interface:PrismContext
Creates a new Objectable of a given type.- Specified by:
createObjectable
in interfacePrismContext
- Parameters:
clazz
- Static type of the object to be created.- Returns:
- New PrismObject's objectable content.
- Throws:
SchemaException
- If a definition for the given class couldn't be found.
-
createKnownObject
@NotNull public <O extends Objectable> @NotNull PrismObject<O> createKnownObject(@NotNull @NotNull Class<O> clazz) Description copied from interface:PrismContext
Creates a new PrismObject of a given static type. It is expected that the type exists, so any SchemaExceptions will be thrown as run-time exception.- Specified by:
createKnownObject
in interfacePrismContext
- Parameters:
clazz
- Static type of the object to be created.- Returns:
- New PrismObject.
-
createKnownObjectable
Description copied from interface:PrismContext
Creates a new Objectable of a given static type. It is expected that the type exists, so any SchemaExceptions will be thrown as run-time exception.- Specified by:
createKnownObjectable
in interfacePrismContext
- Parameters:
clazz
- Static type of the object to be created.- Returns:
- New PrismObject's objectable content.
-
getLexicalProcessorRegistry
-
isDefaultRelation
- Specified by:
isDefaultRelation
in interfacePrismContext
-
relationsEquivalent
- Specified by:
relationsEquivalent
in interfacePrismContext
-
relationMatches
- Specified by:
relationMatches
in interfacePrismContext
-
relationMatches
Description copied from interface:PrismContext
Returns true of any of the relation in the relationQuery list matches specified relation.- Specified by:
relationMatches
in interfacePrismContext
-
getDefaultParsingContext
- Specified by:
getDefaultParsingContext
in interfacePrismContext
-
createParsingContextForAllowMissingRefTypes
- Specified by:
createParsingContextForAllowMissingRefTypes
in interfacePrismContext
-
createParsingContextForCompatibilityMode
- Specified by:
createParsingContextForCompatibilityMode
in interfacePrismContext
-
emptyPath
- Specified by:
emptyPath
in interfacePrismContext
-
path
- Specified by:
path
in interfacePrismContext
-
hacks
- Specified by:
hacks
in interfacePrismContext
-
xnodeFactory
- Specified by:
xnodeFactory
in interfacePrismContext
-
xnodeMutator
- Specified by:
xnodeMutator
in interfacePrismContext
-
createInitializedProtector
Description copied from interface:ProtectorCreator
Creates initialized KeyStoreBasedProtector according to configured KeyStoreBasedProtectorBuilder object.- Specified by:
createInitializedProtector
in interfaceProtectorCreator
-
createProtector
Description copied from interface:ProtectorCreator
Creates uninitialized KeyStoreBasedProtector according to configured KeyStoreBasedProtectorBuilder object.- Specified by:
createProtector
in interfaceProtectorCreator
-
toUniformPath
Description copied from interface:PrismContext
Temporary- Specified by:
toUniformPath
in interfacePrismContext
-
toUniformPathKeepNull
- Specified by:
toUniformPathKeepNull
in interfacePrismContext
-
toUniformPath
- Specified by:
toUniformPath
in interfacePrismContext
-
createCanonicalItemPath
Description copied from interface:PrismContext
Temporary- Specified by:
createCanonicalItemPath
in interfacePrismContext
-
createCanonicalItemPath
Description copied from interface:PrismContext
Temporary- Specified by:
createCanonicalItemPath
in interfacePrismContext
-
deltaFor
Description copied from interface:PrismContext
Starts a delta builder, with the default item definition resolution (i.e. from the system-wide schema).- Specified by:
deltaFor
in interfacePrismContext
- Throws:
SchemaException
-
deltaFor
public <C extends Containerable> S_ItemEntry deltaFor(Class<C> objectClass, ItemDefinitionResolver itemDefinitionResolver) throws SchemaException Description copied from interface:PrismContext
Starts a delta builder, with a custom item definition resolver (e.g. for resource-specific deltas). Usually not called directly from a general client code.- Specified by:
deltaFor
in interfacePrismContext
- Throws:
SchemaException
-
queryFor
Description copied from interface:PrismContext
Starts a query builder with the goal of creating a query targeted at given object or container type. The resolution of items (properties, references, containers) used in the query formulation is done by the default process, i.e. from the system-wide schema.- Specified by:
queryFor
in interfacePrismContext
- Parameters:
type
- The type of object or container values queried. This information is used to resolve the definitions of items used in query formulation. It is _not_ meant to restrict the objects returned when the query is eventually applied. If you want to restrict the type of objects returned right in the query (and not just when making e.g. the `searchObjects` call), please consider usingS_FilterEntry.type(Class)
orS_FilterEntry.type(QName)
.
-
queryFor
public S_FilterEntryOrEmpty queryFor(Class<? extends Containerable> type, ItemDefinitionResolver itemDefinitionResolver) Description copied from interface:PrismContext
Starts a query builder, with a custom item definition resolver (e.g. for resource-specific queries). Usually not called directly from a general client code.- Specified by:
queryFor
in interfacePrismContext
- See Also:
-
queryForReferenceOwnedBy
public S_FilterEntryOrEmpty queryForReferenceOwnedBy(Class<? extends Containerable> ownerClass, ItemPath referencePath) Description copied from interface:PrismContext
Starts a query builder for reference search, with the default item definition resolution (i.e. from the system-wide schema). After this call the mandatory owned-by filter based on the provided parameters is initiated. The next step can be: * writing a filter (e.g. item+condition call) which will be interpreted as a nested owner filter; * starting a block, which will, again, specify the nested owner filter; * continuing with other filter using and/or (which finishes the owned-by filter) - unless a logical filter, the next filter should be a ref filter; * or callingS_QueryExit.build()
to finish the query builder.- Specified by:
queryForReferenceOwnedBy
in interfacePrismContext
-
deltaFactory
Description copied from interface:PrismContext
Access point to the "old" way of creating deltas. It is generally considered deprecated. DeltaBuilder (accessed via deltaFor method) should be used instead.However, because there is some functionality (like creation of empty deltas) that is not covered by the delta builder, we keep this method not marked as deprecated. Only particular parts of DeltaFactory are marked as deprecated.
- Specified by:
deltaFactory
in interfacePrismContext
-
queryFactory
Description copied from interface:PrismContext
Access point to the "old" way of creating queries, filters and paging instructions. It is generally considered deprecated. QueryBuilder (accessed via queryFor method) should be used instead.However, because there is some functionality (like creation of standalone paging instructions) that is not covered by the query builder, we keep this method not marked as deprecated. Only particular parts of QueryFactory are marked as deprecated.
- Specified by:
queryFactory
in interfacePrismContext
-
itemFactory
- Specified by:
itemFactory
in interfacePrismContext
-
definitionFactory
- Specified by:
definitionFactory
in interfacePrismContext
-
itemPathParser
- Specified by:
itemPathParser
in interfacePrismContext
-
itemPathSerializer
- Specified by:
itemPathSerializer
in interfacePrismContext
-
setExtraValidation
public void setExtraValidation(boolean value) - Specified by:
setExtraValidation
in interfacePrismContext
-
schemaFactory
- Specified by:
schemaFactory
in interfacePrismContext
-
setValueMetadataFactory
- Specified by:
setValueMetadataFactory
in interfacePrismContext
-
getValueMetadataFactory
- Specified by:
getValueMetadataFactory
in interfacePrismContext
-
getProvenanceEquivalenceStrategy
- Specified by:
getProvenanceEquivalenceStrategy
in interfacePrismContext
-
setProvenanceEquivalenceStrategy
-
registerQueryExpressionFactory
- Specified by:
registerQueryExpressionFactory
in interfacePrismContext
-
createQueryParser
- Specified by:
createQueryParser
in interfacePrismContext
-
querySerializer
- Specified by:
querySerializer
in interfacePrismContext
-
registerValueBasedDefinitionLookup
- Specified by:
registerValueBasedDefinitionLookup
in interfacePrismContext
-
valueBasedDefinitionLookupsForType
public Collection<ValueBasedDefinitionLookupHelper> valueBasedDefinitionLookupsForType(QName typeName) - Specified by:
valueBasedDefinitionLookupsForType
in interfacePrismContext
-