oracle.xml.xquery

## Interface OXQEntityLoader

    public interface OXQEntityLoader

Manages the lifecycle of schemas and modules in the static context.

Each `OXQConnection` instance maintains one or two entity loaders depending on its configuration:

- Connection-scoped entity loader
- Expression-scoped entity loader

Their properties are as follows:

Property | Connection-scoped | Expression-scoped
--- | --- | ---
Availability | Always | Only when the connection is created from a data source with the flag `OXQDataSource.IMPORT_SHARING` set to `"true"`
Accessing loaded modules/schemas from XQuery | Implicitly available, no need to import in the query prolog | Must be explicitly imported by query prolog
Supports unloading schemas/modules with the `unload()` method | No | Yes

Since:
  12.1

### Method Summary

All Methods Instance Methods Abstract Methods
`java.util.Set<java.lang.String>` `list(OXQEntityKind entityKind)` Returns the set of target namespaces of all entities of the given kind currently loaded into this context.
`void` `load(OXQEntityKind entityKind, java.lang.String namespaceURI, java.lang.String... locations)` Loads the specified entity (module or schema) into the corresponding context.
`void` `unload(OXQEntityKind entityKind, java.lang.String namespaceURI)` Removes the loaded entity (module/schema) and transitively all other entities that depend on it.

### Method Detail

#### load

    void load(OXQEntityKind entityKind,
              java.lang.String namespaceURI,
              java.lang.String... locations)
       throws XQException

Loads the specified entity (module or schema) into the corresponding context. The source of the schema/module is obtained from `OXQEntityResolver` associated with the connection and then parsed and loaded into memory.

Parameters:
  `entityKind` - `OXQEntityKind.MODULE` or `OXQEntityKind.SCHEMA`
  `namespaceURI` - target namespace
  `locations` - locations where an entity could be found
Throws:
  `XQException` - if `namespaceURI` is not absolute, if entity was not found or couldn't be loaded for any reason, or if `entityKind` is not `OXQEntityKind.MODULE` or `OXQEntityKind.SCHEMA`

#### unload

    void unload(OXQEntityKind entityKind,
                java.lang.String namespaceURI)
         throws XQException

Removes the loaded entity (module/schema) and transitively all other entities that depend on it. The entity will be reread from the entity resolver if it is imported by a subsequent query.

Parameters:
  `entityKind` - `OXQEntityKind.MODULE` or `OXQEntityKind.SCHEMA`
  `namespaceURI` - namespace URI of the entity
Throws:
  `XQException` - namespaceURI is not absolute or if `entityKind` is not `OXQEntityKind.MODULE` or `OXQEntityKind.SCHEMA`
  `java.lang.UnsupportedOperationException` - if context of this loader doesn't support removal operation for this entity kind

#### list

    java.util.Set<java.lang.String> list(OXQEntityKind entityKind)
                                  throws XQException

Returns the set of target namespaces of all entities of the given kind currently loaded into this context.

Parameters:
  `entityKind` - `OXQEntityKind.MODULE` or `OXQEntityKind.SCHEMA`
Returns:
  set of namespace URIs
Throws:
  `XQException` - if `entityKind` is not `OXQEntityKind.MODULE` or `OXQEntityKind.SCHEMA`

Copyright © 2003, 2019, Oracle and/or its affiliates. All rights reserved.
Use is subject to license terms. Also see the documentation redistribution policy.
ORACLE CONFIDENTIAL
For authorized use only.
Do not distribute to third parties.