]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - ProvidedSession.java
075f7bd1beccd47a4a9c38a258c96b9ce58eec63
1 package org
.argeo
.api
.acr
.spi
;
3 import java
.util
.Iterator
;
4 import java
.util
.concurrent
.CompletionStage
;
6 import org
.argeo
.api
.acr
.Content
;
7 import org
.argeo
.api
.acr
.ContentSession
;
9 /** A {@link ContentSession} implementation. */
10 public interface ProvidedSession
extends ContentSession
{
11 ProvidedRepository
getRepository();
13 CompletionStage
<ProvidedSession
> onClose();
15 Content
getMountPoint(String path
);
19 void notifyModification(ProvidedContent content
);
26 default String
getPrefix(String namespaceURI
) {
27 Iterator
<String
> prefixes
= getPrefixes(namespaceURI
);
28 return prefixes
.hasNext() ? prefixes
.next() : null;
31 // /** @return the bound namespace or null if not found */
32 // String findNamespace(String prefix);
34 // // TODO find the default prefix?
35 // Set<String> findPrefixes(String namespaceURI);
37 // /** To be overridden for optimisation, as it will be called a lot */
38 // default String findPrefix(String namespaceURI) {
39 // Set<String> prefixes = findPrefixes(namespaceURI);
40 // if (prefixes.isEmpty())
42 // return prefixes.iterator().next();
46 // default String getNamespaceURI(String prefix) {
47 // String namespaceURI = NamespaceUtils.getStandardNamespaceURI(prefix);
48 // if (namespaceURI != null)
49 // return namespaceURI;
50 // if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix))
51 // return XMLConstants.NULL_NS_URI;
52 // namespaceURI = findNamespace(prefix);
53 // if (namespaceURI != null)
54 // return namespaceURI;
55 // return XMLConstants.NULL_NS_URI;
59 // default String getPrefix(String namespaceURI) {
60 // String prefix = NamespaceUtils.getStandardPrefix(namespaceURI);
61 // if (prefix != null)
63 // if (XMLConstants.NULL_NS_URI.equals(namespaceURI))
64 // return XMLConstants.DEFAULT_NS_PREFIX;
65 // return findPrefix(namespaceURI);
69 // default Iterator<String> getPrefixes(String namespaceURI) {
70 // Iterator<String> standard = NamespaceUtils.getStandardPrefixes(namespaceURI);
71 // if (standard != null)
73 // if (XMLConstants.NULL_NS_URI.equals(namespaceURI))
74 // return Collections.singleton(XMLConstants.DEFAULT_NS_PREFIX).iterator();
75 // Set<String> prefixes = findPrefixes(namespaceURI);
76 // assert prefixes != null;
77 // return prefixes.iterator();