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 classReadableResource.Builder<T extends ReadableResource.Builder<T>>Generic builder which is extended by readable resource builders, as well as builders for the other base resource typesCRUDResourceandImmutableResource, respectively. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.janeirodigital.sai.httputils.ContentTypeprotected org.apache.jena.rdf.model.Modelprotected booleanprotected final okhttp3.OkHttpClientprotected Stringprotected org.apache.jena.rdf.model.Resourceprotected final SaiSessionprotected booleanprotected final URI -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedReadableResource(ReadableResource.Builder<?> builder) Construct a Readable resource using the providedReadableResource.Builder. -
Method Summary
Modifier and TypeMethodDescriptionstatic okhttp3.ResponsecheckReadableResponse(okhttp3.Response response) Checks the response when fetching data for a readable resourceprotected static okhttp3.Responseread(URI uri, SaiSession saiSession, com.janeirodigital.sai.httputils.ContentType contentType, boolean unprotected) Reads the remote RDF resource aturi, providing credentials from theSaiSessionwhenunprotectedis 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.Builderor 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 theSaiSessionwhenunprotectedis not true.- Parameters:
uri- URI to GETsaiSession-SaiSessionto usecontentType-ContentTypeto acceptunprotected- When true, does not send authorization headers- Returns:
- OkHttp Response
- Throws:
SaiExceptioncom.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
-