Package org.fcrepo.http.commons.api.rdf
Class HttpIdentifierConverter
- java.lang.Object
-
- org.fcrepo.http.commons.api.rdf.HttpIdentifierConverter
-
public class HttpIdentifierConverter extends Object
Convert between HTTP URIs (LDP paths) and internal Fedora ID using a JAX-RS UriBuilder to mediate the URI translation.- Since:
- 2019-09-26
- Author:
- whikloj
-
-
Constructor Summary
Constructors Constructor Description HttpIdentifierConverter()TODO: This constructor should be removed! ..it is only used so that Spring can create this class...HttpIdentifierConverter(javax.ws.rs.core.UriBuilder uriBuilder)Create a new identifier converter within the given session with the given URI template
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleaninExternalDomain(String httpUri)Test if the provided external URI is in the domain of this repository.booleaninInternalDomain(String fedoraId)Check if the provided internal identifier is in the domain of the repository.org.fcrepo.kernel.api.identifiers.FedoraIdpathToInternalId(String externalPath)Function to convert from the external path of a URI to an internal FedoraId.StringtoDomain(String path)Convert a path to a full url using the UriBuilder template.StringtoExternalId(String fedoraId)Convert an internal identifier to an external URI.StringtoInternalId(String httpUri)Convert an external URI to an internal ID.
-
-
-
Constructor Detail
-
HttpIdentifierConverter
public HttpIdentifierConverter(javax.ws.rs.core.UriBuilder uriBuilder)
Create a new identifier converter within the given session with the given URI template- Parameters:
uriBuilder- the uri builder
-
HttpIdentifierConverter
public HttpIdentifierConverter()
TODO: This constructor should be removed! ..it is only used so that Spring can create this class... since it is unclear where the `UriBuilder` will come ..from when this class is expected to be injected into `ContentExposingResource.java`
-
-
Method Detail
-
toInternalId
public String toInternalId(String httpUri)
Convert an external URI to an internal ID.- Parameters:
httpUri- the external URI.- Returns:
- the internal identifier.
-
inExternalDomain
public boolean inExternalDomain(String httpUri)
Test if the provided external URI is in the domain of this repository. If it is not in the domain we can't convert it.- Parameters:
httpUri- the external URI.- Returns:
- true if it is in domain.
-
toExternalId
public String toExternalId(String fedoraId)
Convert an internal identifier to an external URI.- Parameters:
fedoraId- the internal identifier.- Returns:
- the external URI.
-
inInternalDomain
public boolean inInternalDomain(String fedoraId)
Check if the provided internal identifier is in the domain of the repository. If it is not in the domain we can't convert it.- Parameters:
fedoraId- the internal identifier.- Returns:
- true if it is in domain.
-
toDomain
public String toDomain(String path)
Convert a path to a full url using the UriBuilder template.- Parameters:
path- the external path.- Returns:
- the full url.
-
pathToInternalId
public org.fcrepo.kernel.api.identifiers.FedoraId pathToInternalId(String externalPath)
Function to convert from the external path of a URI to an internal FedoraId.- Parameters:
externalPath- the path part of the external URI.- Returns:
- the FedoraId.
-
-