Package org.trellisldp.namespace
Class SimpleNamespaceService
- java.lang.Object
-
- org.trellisldp.namespace.SimpleNamespaceService
-
- All Implemented Interfaces:
NamespaceService
@ApplicationScoped public class SimpleNamespaceService extends Object implements NamespaceService
A simple, in-memory namespace service.This service will load some standard namespaces/prefixes and read system properties into the namespace maping if they are defined like so: "trellis.ns-myprefix=http://example.com/namespace"
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONFIG_NAMESPACE_MAPPING
-
Constructor Summary
Constructors Constructor Description SimpleNamespaceService()Create a simple, in-memory namespace service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>getNamespaces()Fetch the entire namespace mapping.booleansetPrefix(String prefix, String namespace)Set the namespace for a given prefix.
-
-
-
Field Detail
-
CONFIG_NAMESPACE_MAPPING
public static final String CONFIG_NAMESPACE_MAPPING
- See Also:
- Constant Field Values
-
-
Method Detail
-
getNamespaces
public Map<String,String> getNamespaces()
Description copied from interface:NamespaceServiceFetch the entire namespace mapping.- Specified by:
getNamespacesin interfaceNamespaceService- Returns:
- the namespace mapping as prefix, namespace pairs
-
setPrefix
public boolean setPrefix(String prefix, String namespace)
Description copied from interface:NamespaceServiceSet the namespace for a given prefix.- Specified by:
setPrefixin interfaceNamespaceService- Parameters:
prefix- the prefixnamespace- the namespace- Returns:
- whether the new prefix was set
-
-