Class ReadableResource
java.lang.Object
com.janeirodigital.sai.core.resources.ReadableResource
- Direct Known Subclasses:
CRUDResource
,ImmutableResource
,ReadableAccessGrant
,ReadableAgentRegistration
,ReadableApplicationProfile
,ReadableDataGrant
,ReadableDataRegistration
,ReadableSocialAgentProfile
Represents a corresponding RDF Resource and provides read-only capabilities.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
ReadableResource.Builder<T extends ReadableResource.Builder<T>>
Generic builder which is extended by readable resource builders, as well as builders for the other base resource typesCRUDResource
andImmutableResource
, respectively. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.janeirodigital.sai.httputils.ContentType
protected org.apache.jena.rdf.model.Model
protected boolean
protected final okhttp3.OkHttpClient
protected String
protected org.apache.jena.rdf.model.Resource
protected final SaiSession
protected boolean
protected final URI
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ReadableResource
(ReadableResource.Builder<?> builder) Construct a Readable resource using the providedReadableResource.Builder
. -
Method Summary
Modifier and TypeMethodDescriptionstatic okhttp3.Response
checkReadableResponse
(okhttp3.Response response) Checks the response when fetching data for a readable resourceprotected static okhttp3.Response
read
(URI uri, SaiSession saiSession, com.janeirodigital.sai.httputils.ContentType contentType, boolean unprotected) Reads the remote RDF resource aturi
, providing credentials from theSaiSession
whenunprotected
is not true.
-
Field Details
-
uri
-
saiSession
-
httpClient
protected final okhttp3.OkHttpClient httpClient -
dataset
protected org.apache.jena.rdf.model.Model dataset -
resource
protected org.apache.jena.rdf.model.Resource resource -
contentType
protected com.janeirodigital.sai.httputils.ContentType contentType -
jsonLdContext
-
unprotected
protected boolean unprotected -
exists
protected boolean exists
-
-
Constructor Details
-
ReadableResource
Construct a Readable resource using the providedReadableResource.Builder
.- Parameters:
builder
-ReadableResource.Builder
or an instance of an inheriting subclass- Throws:
SaiException
-
-
Method Details
-
read
protected static okhttp3.Response read(URI uri, SaiSession saiSession, com.janeirodigital.sai.httputils.ContentType contentType, boolean unprotected) throws SaiException, com.janeirodigital.sai.httputils.SaiHttpNotFoundException Reads the remote RDF resource aturi
, providing credentials from theSaiSession
whenunprotected
is not true.- Parameters:
uri
- URI to GETsaiSession
-SaiSession
to usecontentType
-ContentType
to acceptunprotected
- When true, does not send authorization headers- Returns:
- OkHttp Response
- Throws:
SaiException
com.janeirodigital.sai.httputils.SaiHttpNotFoundException
-
checkReadableResponse
public static okhttp3.Response checkReadableResponse(okhttp3.Response response) throws com.janeirodigital.sai.httputils.SaiHttpNotFoundException, SaiException Checks the response when fetching data for a readable resource- Parameters:
response
- Response to check- Returns:
- Checked Response
- Throws:
com.janeirodigital.sai.httputils.SaiHttpNotFoundException
- when the resource cannot be found (HTTP 404)SaiException
- when the response code is unsuccessful for any other reason
-