public class GlobalNameMapper extends Object implements NameMapper
Note that even though this class could be used to verify that all prefixed names have valid prefixes, we explicitly don't do that since this is a fairly performance-sensitive part of the codebase and since normally the NameValidator and other consistency checks already ensure that all names being committed or already in the repository should be valid. A separate consistency check can be used if needed to locate and fix any Oak names with invalid namespace prefixes.
| Constructor and Description |
|---|
GlobalNameMapper(Map<String,String> mappings) |
GlobalNameMapper(NodeState root) |
GlobalNameMapper(Root root) |
| Modifier and Type | Method and Description |
|---|---|
@NotNull String |
getJcrName(@NotNull String oakName)
Returns the JCR name for the given Oak name.
|
@NotNull String |
getOakName(@NotNull String jcrName)
Returns the Oak name for the specified JCR name.
|
@Nullable String |
getOakNameOrNull(@NotNull String jcrName)
Returns the Oak name for the given JCR name, or
null if no
such mapping exists because the given JCR name contains an unknown
namespace URI or prefix, or is otherwise invalid. |
@NotNull Map<String,String> |
getSessionLocalMappings()
Returns the local namespace prefix mappings, or an empty map if
there aren't any local mappings.
|
void |
onSessionRefresh() |
public GlobalNameMapper(Root root)
public GlobalNameMapper(NodeState root)
@NotNull public @NotNull String getJcrName(@NotNull @NotNull String oakName)
NameMappergetJcrName in interface NameMapperoakName - Oak name@Nullable public @Nullable String getOakNameOrNull(@NotNull @NotNull String jcrName)
NameMappernull if no
such mapping exists because the given JCR name contains an unknown
namespace URI or prefix, or is otherwise invalid.getOakNameOrNull in interface NameMapperjcrName - JCR namenull@NotNull public @NotNull String getOakName(@NotNull @NotNull String jcrName) throws RepositoryException
NameMapperNameMapper.getOakNameOrNull(String) this method will throw a RepositoryException
if the JCR name is invalid and cannot be resolved.getOakName in interface NameMapperjcrName - The JCR name to be converted.RepositoryException - If the JCR name cannot be resolved.@NotNull public @NotNull Map<String,String> getSessionLocalMappings()
NameMappergetSessionLocalMappings in interface NameMapperpublic void onSessionRefresh()
Copyright © 2010 - 2020 Adobe. All Rights Reserved