public final class OXQEntity extends java.lang.Object implements OXQCloseable, java.lang.Cloneable
OXQEntityResolver.
The entity is made up of a data object, a media-type, and a set of properties.
The type of data depends on the kind of entity that is being
resolved. The following sections describe what data is expected to be for
the possible entity kinds.
OXQEntityKind.SCHEMA)Type of data |
Description |
|---|---|
java.io.InputStream java.io.Reader java.lang.String javax.xml.transform.Source |
A schema will be obtained by parsing data as an XML Schema.
|
javax.xml.xquery.XQItem |
A schema will be obtained by treating data as a parsed XML Schema.
|
An array or java.util.Collection of any of the above types.
|
One or more schemas will be obtained by treating each object in the array/collection as described above. |
The media-type is currently ignored for schemas but it may be used in future releases.
All schemas returned must have the target namespace that was specified in the OXQEntityLocator instance
passed to the entity resolver.
OXQEntityKind.MODULE)
Type of data |
Description |
|---|---|
java.io.InputStream java.io.Reader java.lang.String javax.xml.transform.Source |
If the media-type is application/xquery+xml then data will be parsed as an XQueryX module. Otherwise,
data will be parsed as an XQuery module.
|
javax.xml.xquery.XQItem |
If the media-type is application/xquery+xml then data will be will be treated as a parsed XQueryX module.
Otherwise, data will be serialized as text and then parsed as an XQuery module.
|
An array or java.util.Collection of any of the above types.
|
One or more modules will be obtained by treating each object in the array/collection as described above. |
OXQEntityLocator instance
passed to the entity resolver.
javax.xml.xquery.XQStaticContext can be set on the returned entity using the
property PROPERTY_MODULE_STATIC_CONTEXT.
It specifies the following default values when compiling this module:
XQStaticContext,
XQStaticContext.getQueryLanguageTypeAndVersion(),OXQStaticContext: declared functions and variables,
imported modules and schemas, entity resolver.
XQStaticContext or OXQStaticContext are ignored.
OXQEntityKind.DOCUMENT)
Type of data |
Description |
|---|---|
java.io.InputStream java.io.Reader java.lang.String javax.xml.transform.Source |
A document will be obtained by parsing
XML_ENTITY kind.
|
javax.xml.xquery.XQSequence |
The sequence must either be empty or contain a single document node.
This will be used directly for the fn:doc or fn:collection function.
|
javax.xml.xquery.XQItem |
The item must be a document node.
This will be used directly for the fn:doc or fn:collection function.
Note, data may be null to signify the empty sequence.
|
PROPERTY_INFOSET_COMMENTSPROPERTY_INFOSET_SIGNIFICANT_WHITESPACEPROPERTY_INFOSET_INSIGNIFICANT_WHITESPACEPROPERTY_INFOSET_NAMESPACESPROPERTY_XML_PARSER_VALIDATINGPROPERTY_DOCUMENT_PAGE_MANAGEROXQEntityKind.DOCUMENT_TYPE)
data must be an instance of java.xml.xquery.XQItemType that is
a subtype of document-node(). The returned type will be used as the static type
of the fn:doc function.
OXQEntityKind.COLLECTION)
data must be an instance of java.util.Iterator<java.net.URI>.
For each URI returned, the entity resolver will be called using the DOCUMENT entity kind
to obtain a document node. The documents will be returned by the call to fn:collection.
Each document URI returned by the Iterator must be unique or an error will be raised.
This uniqueness check may be disabled by setting property PROPERTY_COLLECTION_UNIQUE_CHECK
to false on the returned entity using method setProperty(int, Object).
Even if this check is disabled, the returned document URIs must still be unique or else the query
results may be incorrect. Disabling the check may improve performance in cases where there are
many document URIs.
URI_COLLECTION)
data must be an instance of java.util.Iterator<java.net.URI>.
The OXQEntityKind.URI_COLLECTION kind is used to resolve the result of a
call to the fn:uri-collection function. Unlike the OXQEntityKind.COLLECTION
kind, there is no requirement that the returned URI's are unique or that they identify documents.
However, entity resolvers may be implemented such that the results of fn:collection and
fn:collection-uri are consistent.
OXQEntityKind.EXTERNAL_FUNCTION)
Type of data |
Description |
|---|---|
java.lang.Class |
The class must extend OXQFunctionEvaluator. |
java.lang.Method |
The method must be static with parameter and return types that can be mapped to XQuery types as defined by XQJ specification. |
The media-type is ignored in this case.
OXQEntityKind.XML_ENTITY)
data must be an instance of java.io.InputStream, java.xml.stream.XMLStreamReader, or
java.xml.stream.XMLEventReader
DOCUMENT.
upd:put Entities (OXQEntityKind.UPD_PUT)
data must be a class that extends OXQFunctionEvaluator. The
returned class will be instantiated and then the evaluate method
will be invoked. The first XQSequence argument provided is the node to store. The second
XQSequence argument is an absolute URI (as xs:string) which is the location where the node should be stored. Each returned OXQFunctionEvaluator
may be instantiated once and reused multiple times.
evaluate method raises an error.
OXQEntityKind.XML_PARSER_FACTORY)
data must be an instance of javax.xml.stream.XMLInputFactory.
See also:
OXQEntityKind.DOM_FACTORY)
data must be an instance of javax.xml.parsers.DocumentBuilderFactory.
COLLATION)
data must be an instance of java.text.Collator or oracle.i18n.text.OraCollator.
When a java.text.Collator is returned, the functions fn:contains, fn:starts-with,
fn:ends-with, fn:substring-before, fn:substring-after will raise an error unless
the returned Collator is also a java.text.RuleBasedCollator.
TEXT)
data must be an instance of java.io.InputStream, java.io.Reader, or java.lang.String.
The TEXT kind is used to resolve the result of a call to the fn:unparsed-text function.
In the case of java.io.InputStream, the bytes will be decoded as specified by the
XPath and XQuery Functions and Operators.
ENVIRONMENT_VARIABLE)
If requesting OXQEntityLocator.getSystemId() was null then
data must be an instance of java.util.Iterator<java.lang.String>
containing all environment variable names.
If OXQEntityLocator.getSystemId() was not null then
data must be an instance of java.lang.String containing
the value of the requested environment variable or null if
there is no such variable.
The entity returned by OXQEntityResolver can have closeable resources associated with it
through OXQCloseable methods. The XQuery processor assumes ownership of these resources and
guarantees that they are closed when the query execution finishes.
| Modifier and Type | Field and Description |
|---|---|
static int |
DOCUMENT_URI_HIDE
A string value constant for
PROPERTY_XML_PARSER_DOCUMENT_URI |
static int |
DOCUMENT_URI_PASS
A string value constant for
PROPERTY_XML_PARSER_DOCUMENT_URI |
static int |
DOCUMENT_URI_PASS_URL
A string value constant for
PROPERTY_XML_PARSER_DOCUMENT_URI |
static java.lang.String |
MEDIA_TYPE_APPLICATION_XML
Media-type "application/xml"
|
static java.lang.String |
MEDIA_TYPE_ORACLE_CSX
Media-type "application/vnd.oracle.xml+csx"
|
static java.lang.String |
MEDIA_TYPE_ORACLE_XPATH
Media-type "application/vnd.oracle.xml.xpath"
|
static java.lang.String |
MEDIA_TYPE_TEXT_XML
Media-type "text/xml"
|
static java.lang.String |
MEDIA_TYPE_XQUERY
Media-type "application/xquery"
|
static java.lang.String |
MEDIA_TYPE_XQUERYX
Media-type "application/xquery+xml"
|
static int |
PROPERTY_COLLECTION_UNIQUE_CHECK
The property that specifies whether or not the XQuery processor will ensure that the document
URIs returned by a
COLLECTION entity are unique. |
static int |
PROPERTY_DOCUMENT_PAGE_MANAGER
The property that specifies an instance of
PageManager that will
be used to store a DOCUMENT entity. |
static int |
PROPERTY_INFOSET_COMMENTS
The property that specifies whether comment nodes are preserved when converting XML
to the XQuery data model.
|
static int |
PROPERTY_INFOSET_INSIGNIFICANT_WHITESPACE
The property that specifies whether insignificant whitespace in an XML document is
preserved or ignored when converting XML
to the XQuery data model.
|
static int |
PROPERTY_INFOSET_NAMESPACES
The property that specifies whether namespaces that are not known to be used are preserved
when converting XML to the XQuery data model.
|
static int |
PROPERTY_INFOSET_SIGNIFICANT_WHITESPACE
The property that specifies whether significant whitespace in an XML document is preserved or
ignored when converting XML
to the XQuery data model.
|
static int |
PROPERTY_MODULE_STATIC_CONTEXT
The property that specifies an instance of
XQStaticContext to be used with a
returned MODULE entity. |
static int |
PROPERTY_XML_PARSER_DETECT_ENCODING
The property that specifies whether the XML parser performs document encoding detection or
the encoding is detected by the XQuery processor.
|
static int |
PROPERTY_XML_PARSER_DOCUMENT_URI
The property that specifies whether the XQuery processor passes the document URI to the XML
parser or not.
|
static int |
PROPERTY_XML_PARSER_VALIDATING
The property that specifies whether or not to use a validating XML parser (performing DTD validation).
|
| Constructor and Description |
|---|
OXQEntity(java.lang.Object data)
Constructs an entity.
|
OXQEntity(java.lang.Object data,
java.lang.String mediaType)
Constructs an entity.
|
| Modifier and Type | Method and Description |
|---|---|
OXQEntity |
clone()
Standard override; no change in semantics.
|
void |
enlistCloseable(java.io.Closeable closeable)
Declares a
closeable object that will be closed when this object is closed. |
void |
enlistCloseable(javax.xml.stream.XMLStreamReader closeable)
Declares an
XMLStreamReader object that will be closed when this object is closed. |
void |
enlistCloseable(XQSequence closeable)
Declares an
XQSequence object that will be closed when this object is closed. |
java.lang.Object |
getData()
Returns the entity.
|
java.lang.Object[] |
getEnlistedCloseables()
Returns closeable resources associated with this entity.
|
java.lang.String |
getMediaType()
Returns the Media-Type of the entity
|
java.lang.Object |
getProperty(int key)
Returns the property value for the given property key.
|
void |
setData(java.lang.Object data)
Sets the entity.
|
void |
setMediaType(java.lang.String mediaType)
Sets the Media-Type of the entity.
|
void |
setProperty(int key,
java.lang.Object value)
Sets additional processing options for this entity.
|
public static final java.lang.String MEDIA_TYPE_APPLICATION_XML
setMediaType(String),
Constant Field Valuespublic static final java.lang.String MEDIA_TYPE_TEXT_XML
setMediaType(String),
Constant Field Valuespublic static final java.lang.String MEDIA_TYPE_ORACLE_CSX
setMediaType(String),
Constant Field Valuespublic static final java.lang.String MEDIA_TYPE_ORACLE_XPATH
setMediaType(String),
Constant Field Valuespublic static final java.lang.String MEDIA_TYPE_XQUERY
setMediaType(String),
Constant Field Valuespublic static final java.lang.String MEDIA_TYPE_XQUERYX
setMediaType(String),
Constant Field Valuespublic static final int PROPERTY_XML_PARSER_DOCUMENT_URI
DOCUMENT_URI_PASS - document URI is passed to the XML parser,DOCUMENT_URI_HIDE - document URI is not passed to the XML parser,DOCUMENT_URI_PASS_URL - document URI is passed to the XML parser only if it's a
valid URL (default)public static final int PROPERTY_XML_PARSER_DETECT_ENCODING
java.lang.Boolean:
true, the XML parser detects the document encoding (default),false, the XQuery processor detects the document encodingpublic static final int PROPERTY_XML_PARSER_VALIDATING
javax.xml.stream.XMLInputFactory.IS_VALIDATING then this option is ignored.
The property value must be an instance of java.lang.Boolean:
true, validating (default),false, non-validatingpublic static final int PROPERTY_INFOSET_COMMENTS
java.lang.Boolean:
true, comment nodes are preserved (default),false, comment nodes are ignoredpublic static final int PROPERTY_INFOSET_NAMESPACES
java.lang.Boolean:
true, document will contain all namespaces, even those that are not known as
per the XDM specification (default),false, document will only those namespace that are knownpublic static final int PROPERTY_INFOSET_SIGNIFICANT_WHITESPACE
PROPERTY_XML_PARSER_VALIDATING). In non-validating mode the parser cannot make that
decision and therefore will report all whitespace as significant. This option only controls
significant whitespace handling. The property value must be an instance of
java.lang.Boolean:
true, the document will contain significant whitespace as reported by the XML
parser (default),false, the document will not contain significant whitespacepublic static final int PROPERTY_INFOSET_INSIGNIFICANT_WHITESPACE
PROPERTY_XML_PARSER_VALIDATING). This option only controls
insignificant whitespace handling (also called element content whitespace). The property
value must be an instance of java.lang.Boolean:
true, the document will contain insignificant whitespace as reported by the XML
parserfalse, the document will not contain insignificant whitespace (default).public static final int PROPERTY_COLLECTION_UNIQUE_CHECK
COLLECTION entity are unique. Even if this check is
disabled, the returned document URIs must still be unique or else the query results may be
incorrect. Disabling the check may improve performance in cases where there are many document
URIs.
The property value must be an instance of java.lang.Boolean:
true, the XQuery processor will raise an error if the document URIs are not
unique (default)false, the XQuery processor will not check that the document URIs are
unique.public static final int PROPERTY_MODULE_STATIC_CONTEXT
XQStaticContext to be used with a
returned MODULE entity. The property value must be an instance of
XQStaticContextpublic static final int PROPERTY_DOCUMENT_PAGE_MANAGER
PageManager that will
be used to store a DOCUMENT entity. The returned document will
be copied into the PageManager. The pages will be released (deleted) when the query
result is closed. The property value must be an
instance of PageManagerpublic static final int DOCUMENT_URI_PASS
PROPERTY_XML_PARSER_DOCUMENT_URIpublic static final int DOCUMENT_URI_HIDE
PROPERTY_XML_PARSER_DOCUMENT_URIpublic static final int DOCUMENT_URI_PASS_URL
PROPERTY_XML_PARSER_DOCUMENT_URIpublic OXQEntity(java.lang.Object data)
data - The entity.public OXQEntity(java.lang.Object data,
java.lang.String mediaType)
data - The entity.mediaType - Media-Type of the entitypublic void setData(java.lang.Object data)
data - the entitypublic java.lang.Object getData()
public void setMediaType(java.lang.String mediaType)
mediaType - the Media-Typepublic java.lang.String getMediaType()
public void setProperty(int key,
java.lang.Object value)
key - the property keyvalue - the property valuepublic java.lang.Object getProperty(int key)
public OXQEntity clone()
clone in class java.lang.Objectpublic void enlistCloseable(java.io.Closeable closeable)
OXQCloseablecloseable object that will be closed when this object is closed.enlistCloseable in interface OXQCloseablecloseable - input streaming object that close() must be
invoked on after close() is invoked on this object.Detailed descriptionpublic void enlistCloseable(javax.xml.stream.XMLStreamReader closeable)
OXQCloseableXMLStreamReader object that will be closed when this object is closed.
Note: XMLStreamReader implementations don't usually conform to the thread-safety semantics
defined above, so their use as resources is not recommended in multi-threaded environments.
enlistCloseable in interface OXQCloseablecloseable - object that close() must be invoked on after
close() is invoked on this object.Detailed descriptionpublic void enlistCloseable(XQSequence closeable)
OXQCloseableXQSequence object that will be closed when this object is closed.enlistCloseable in interface OXQCloseablecloseable - object that close() must be invoked on after
close() is invoked on this object.Detailed descriptionpublic java.lang.Object[] getEnlistedCloseables()
null if no resources have been registeredCopyright © 2003, 2025, Oracle and/or its affiliates.