Class ClientImpl
- java.lang.Object
-
- org.topbraidlive.client.java.impl.ClientImpl
-
- All Implemented Interfaces:
AutoCloseable,Api,UnzipProjectApiFunction,AddProjectImportApiFunction,AddRoleToGroupApiFunction,AddTriplesApiFunction,ApiFunction,CanCreateProjectApiFunction,CanDeleteProjectApiFunction,CheckGovernanceAreaExistsApiFunction,CheckProjectExistsApiFunction,ClearProjectApiFunction,CreateGovernanceAreaApiFunction,CreateProjectApiFunction,DeleteProjectApiFunction,DeleteResourceApiFunction,EnableGovernanceRoleApiFunction,ExecuteSpinTemplateApiFunction,ExecuteSwpViewClassApiFunction,ExportToRdfApiFunction,GetPlatformGraphqlConnectionApiFunction,GetProjectGraphqlConnectionApiFunction,GetRawGraphqlConnectionApiFunction,GetSparqlConnectionApiFunction,ListProjectsApiFunction,QuerySparqlApiFunction,SetGovernanceAreaPermission,Client
public final class ClientImpl extends Object implements Client
Main entry point, a facade client that delegates to various client implementations.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.topbraidlive.client.java.api.exception.UnzipProjectApiFunction
UnzipProjectApiFunction.OldProject
-
-
Constructor Summary
Constructors Constructor Description ClientImpl(ClientConfiguration configuration)Construct a Client instance with a given configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProjectImport(String import_, String projectGraph)Convenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.voidaddProjectImport(Uri import_, ProjectGraphUri projectGraph)Add an import to a project.voidaddRoleToGroup(String group, String role)Convenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.voidaddRoleToGroup(RightsGroupId group, SecurityRoleId role)Add a security role to a rights group.voidaddTriples(boolean complete, String graphUri, org.apache.jena.shared.PrefixMapping prefixMapping, Iterator<org.apache.jena.graph.Triple> triples)Convenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.voidaddTriples(boolean complete, Uri graphUri, org.apache.jena.shared.PrefixMapping prefixMapping, Iterator<org.apache.jena.graph.Triple> triples)Add all triples from the given graphvoidaddTriplesBatched(int batchSize, String graphUri, org.apache.jena.shared.PrefixMapping prefixMapping, Iterator<org.apache.jena.graph.Triple> triples)Convenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.voidaddTriplesBatched(int batchSize, Uri graphUri, org.apache.jena.shared.PrefixMapping prefixMapping, Iterator<org.apache.jena.graph.Triple> triples)Convenience method to add triples in batches from an iterator.booleancanCreateProject()Can the current user create a project?booleancanDeleteProject(String projectGraph)Convenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.booleancanDeleteProject(ProjectGraphUri projectGraph)Can the current user create a project?booleancheckGovernanceAreaExists(String uri)Convenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.booleancheckGovernanceAreaExists(GovernanceAreaUri uri)Check if a governance area exists.booleancheckProjectExists(String projectGraph)Convenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.booleancheckProjectExists(ProjectGraphUri projectGraph)Check if a project exists.voidclearProject(String projectGraph)Convenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.voidclearProject(ProjectGraphUri projectGraph)Clear the contents of a project.voidclose()ClientConfigurationconfiguration()Get the client's configuration.voidcreateGovernanceArea(String label, String type, String uri, String labelLang)Convenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.voidcreateGovernanceArea(String label, GovernanceAreaType type, GovernanceAreaUri uri, Optional<String> labelLang)Create a governance area.ProjectGraphUricreateProject(CreateProjectParameters parameters)Create a project.voiddeleteProject(String projectGraph)Convenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.voiddeleteProject(ProjectGraphUri projectGraph)Delete a project.voiddeleteResource(String base, String resource)Convenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.voiddeleteResource(Uri base, Uri resource)Delete a resource such as a governance area.voidenableGovernanceRole(String governanceRole, String subjectArea)Convenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.voidenableGovernanceRole(GovernanceRoleUri governanceRole, GovernanceAreaUri subjectArea)Enable a governance role.StringexecuteSpinTemplate(ExecuteSpinTemplateParameters parameters)Execute a SPIN template.org.apache.http.client.methods.CloseableHttpResponseexecuteSwpViewClass(ExecuteSwpViewClassParameters parameters)Execute an arbitrary SWP view class.StringexecuteSwpViewClassToString(ExecuteSwpViewClassParameters parameters)Execute an arbitrary SWP view class and return its response (body) as a String.StringexportToRdf(ExportToRdfParameters parameters)Export a project's contents to RDF.TypedGraphqlConnection<RootRDFQueryQuery,RootRDFQuery>getPlatformGraphqlConnection()Get a GraphQL connection for the platform APIO.<RootQueryT extends AbstractQuery<RootQueryT>,RootResponseT extends AbstractResponse<RootResponseT>>
TypedGraphqlConnection<RootQueryT,RootResponseT>getProjectGraphqlConnection(GetProjectGraphqlConnectionParameters<RootQueryT,RootResponseT> parameters)Get a GraphQL connection for a specific project.RawGraphqlConnectiongetRawGraphqlConnection(String endpointUrlPath)Get a raw GraphQL connection.RawGraphqlConnectiongetRawGraphqlConnection(ProjectGraphUri projectGraphUri)Convenience method to get a raw GraphQL connection for a project.RawGraphqlConnectiongetRawGraphqlConnection(ProjectGraphUri projectGraphUri, Optional<ProjectGraphqlSchemaType> projectGraphqlSchemaType)Convenience method to get a raw GraphQL connection for a project.org.apache.jena.rdfconnection.RDFConnectiongetSparqlConnection()Interact with the server via SPARQL.com.google.common.collect.ImmutableList<ProjectGraphUri>listProjects()List project graphs known to the server.org.apache.jena.query.QueryExecutionquerySparql(org.apache.jena.query.Query query, Optional<String> defaultGraph)Query the EDG SPARQL endpoint.voidsetGovernanceRolePermission(String governanceArea, String governancePermission, String governanceRole)Convenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.voidsetGovernanceRolePermission(GovernanceAreaUri governanceArea, GovernancePermission governancePermission, GovernanceRoleUri governanceRole)Set the permission of a governance role in a governance area.voidunzipProject(Path projectZipFilePath, Optional<UnzipProjectApiFunction.OldProject> oldProject)Upload a project as a .zip file to the server.
-
-
-
Constructor Detail
-
ClientImpl
public ClientImpl(ClientConfiguration configuration)
Construct a Client instance with a given configuration.
-
-
Method Detail
-
addProjectImport
public final void addProjectImport(String import_, String projectGraph)
Description copied from interface:ClientConvenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.- Specified by:
addProjectImportin interfaceClient- See Also:
AddProjectImportApiFunction.addProjectImport(Uri, ProjectGraphUri)
-
addProjectImport
public final void addProjectImport(Uri import_, ProjectGraphUri projectGraph)
Description copied from interface:AddProjectImportApiFunctionAdd an import to a project.- Specified by:
addProjectImportin interfaceAddProjectImportApiFunction- Parameters:
import_- URI of a graph to import (importee), such as urn:x-evn-master:childprojectGraph- URI of the project graph to be imported into (importer), such as urn:x-evn-master:parent
-
addTriples
public final void addTriples(boolean complete, String graphUri, org.apache.jena.shared.PrefixMapping prefixMapping, Iterator<org.apache.jena.graph.Triple> triples)Description copied from interface:ClientConvenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.- Specified by:
addTriplesin interfaceClient- See Also:
AddTriplesApiFunction.addTriples(boolean, Uri, PrefixMapping, Iterator)
-
addTriples
public final void addTriples(boolean complete, Uri graphUri, org.apache.jena.shared.PrefixMapping prefixMapping, Iterator<org.apache.jena.graph.Triple> triples)Description copied from interface:AddTriplesApiFunctionAdd all triples from the given graph- Specified by:
addTriplesin interfaceAddTriplesApiFunction- Parameters:
complete- signal whether this is the last batch of triples or notgraphUri- graph URI to add the triples toprefixMapping- namespace prefix mappingtriples- iterator over triples
-
addRoleToGroup
public final void addRoleToGroup(String group, String role)
Description copied from interface:ClientConvenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.- Specified by:
addRoleToGroupin interfaceClient- See Also:
AddRoleToGroupApiFunction.addRoleToGroup(RightsGroupId, SecurityRoleId)
-
addRoleToGroup
public final void addRoleToGroup(RightsGroupId group, SecurityRoleId role)
Description copied from interface:AddRoleToGroupApiFunctionAdd a security role to a rights group.- Specified by:
addRoleToGroupin interfaceAddRoleToGroupApiFunction- Parameters:
group- a rights group such as "readAnyGraphGrp"role- a role such as "ANY_ROLE" or "Admin"
-
addTriplesBatched
public final void addTriplesBatched(int batchSize, String graphUri, org.apache.jena.shared.PrefixMapping prefixMapping, Iterator<org.apache.jena.graph.Triple> triples)Description copied from interface:ClientConvenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.- Specified by:
addTriplesBatchedin interfaceClient- See Also:
Client.addTriplesBatched(int, Uri, PrefixMapping, Iterator)
-
addTriplesBatched
public final void addTriplesBatched(int batchSize, Uri graphUri, org.apache.jena.shared.PrefixMapping prefixMapping, Iterator<org.apache.jena.graph.Triple> triples)Description copied from interface:ClientConvenience method to add triples in batches from an iterator. Delegates to addTriples.- Specified by:
addTriplesBatchedin interfaceClient
-
canCreateProject
public final boolean canCreateProject()
Description copied from interface:CanCreateProjectApiFunctionCan the current user create a project?- Specified by:
canCreateProjectin interfaceCanCreateProjectApiFunction- Returns:
- true if the current user can create a project
-
canDeleteProject
public final boolean canDeleteProject(String projectGraph)
Description copied from interface:ClientConvenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.- Specified by:
canDeleteProjectin interfaceClient- See Also:
CanDeleteProjectApiFunction.canDeleteProject(ProjectGraphUri)
-
canDeleteProject
public final boolean canDeleteProject(ProjectGraphUri projectGraph)
Description copied from interface:CanDeleteProjectApiFunctionCan the current user create a project?- Specified by:
canDeleteProjectin interfaceCanDeleteProjectApiFunction- Parameters:
projectGraph- URI of the project graph e.g., urn:x-evn-master:abcdefg- Returns:
- true if the current user can delete the project
-
checkGovernanceAreaExists
public final boolean checkGovernanceAreaExists(String uri)
Description copied from interface:ClientConvenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.- Specified by:
checkGovernanceAreaExistsin interfaceClient- See Also:
CheckGovernanceAreaExistsApiFunction.checkGovernanceAreaExists(GovernanceAreaUri)
-
checkGovernanceAreaExists
public final boolean checkGovernanceAreaExists(GovernanceAreaUri uri)
Description copied from interface:CheckGovernanceAreaExistsApiFunctionCheck if a governance area exists.- Specified by:
checkGovernanceAreaExistsin interfaceCheckGovernanceAreaExistsApiFunction- Parameters:
uri- URI of the governance area- Returns:
- true if the governance area exists
-
checkProjectExists
public final boolean checkProjectExists(String projectGraph)
Description copied from interface:ClientConvenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.- Specified by:
checkProjectExistsin interfaceClient- See Also:
CheckProjectExistsApiFunction.checkProjectExists(ProjectGraphUri)
-
checkProjectExists
public final boolean checkProjectExists(ProjectGraphUri projectGraph)
Description copied from interface:CheckProjectExistsApiFunctionCheck if a project exists.- Specified by:
checkProjectExistsin interfaceCheckProjectExistsApiFunction- Parameters:
projectGraph- URI of the project graph e.g., urn:x-evn-master:abcdefg- Returns:
- true if the project exists
-
clearProject
public final void clearProject(String projectGraph)
Description copied from interface:ClientConvenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.- Specified by:
clearProjectin interfaceClient- See Also:
ClearProjectApiFunction.clearProject(ProjectGraphUri)
-
clearProject
public final void clearProject(ProjectGraphUri projectGraph)
Description copied from interface:ClearProjectApiFunctionClear the contents of a project.- Specified by:
clearProjectin interfaceClearProjectApiFunction- Parameters:
projectGraph- URI of the project graph e.g., urn:x-evn-master:abcdefg
-
close
public final void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceClient- Throws:
IOException
-
configuration
public final ClientConfiguration configuration()
Description copied from interface:ClientGet the client's configuration.- Specified by:
configurationin interfaceClient
-
createGovernanceArea
public final void createGovernanceArea(String label, String type, String uri, String labelLang)
Description copied from interface:ClientConvenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.- Specified by:
createGovernanceAreain interfaceClient- See Also:
CreateGovernanceAreaApiFunction.createGovernanceArea(String, GovernanceAreaType, GovernanceAreaUri, Optional)
-
createGovernanceArea
public final void createGovernanceArea(String label, GovernanceAreaType type, GovernanceAreaUri uri, Optional<String> labelLang)
Description copied from interface:CreateGovernanceAreaApiFunctionCreate a governance area.- Specified by:
createGovernanceAreain interfaceCreateGovernanceAreaApiFunction- Parameters:
label- label of the new governance areatype- type of governance areauri- URI for the new governance arealabelLang- optional language specifier for the laber
-
createProject
public final ProjectGraphUri createProject(CreateProjectParameters parameters)
Description copied from interface:CreateProjectApiFunctionCreate a project.This function will not fail if you try to create a duplicate project graph. Instead, the server will append a suffix to the project graph URI. This function returns the project graph URI that was created.
- Specified by:
createProjectin interfaceCreateProjectApiFunction- Parameters:
parameters- parameters object- Returns:
- result object
-
deleteProject
public final void deleteProject(String projectGraph)
Description copied from interface:ClientConvenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.- Specified by:
deleteProjectin interfaceClient- See Also:
DeleteProjectApiFunction.deleteProject(ProjectGraphUri)
-
deleteProject
public final void deleteProject(ProjectGraphUri projectGraph)
Description copied from interface:DeleteProjectApiFunctionDelete a project.- Specified by:
deleteProjectin interfaceDeleteProjectApiFunction- Parameters:
projectGraph- URI of the project graph e.g., urn:x-evn-master:abcdefg
-
deleteResource
public final void deleteResource(String base, String resource)
Description copied from interface:ClientConvenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.- Specified by:
deleteResourcein interfaceClient- See Also:
DeleteResourceApiFunction.deleteResource(Uri, Uri)
-
deleteResource
public final void deleteResource(Uri base, Uri resource)
Description copied from interface:DeleteResourceApiFunctionDelete a resource such as a governance area.- Specified by:
deleteResourcein interfaceDeleteResourceApiFunction- Parameters:
base- URI of the project graph e.g., urn:x-evn-master:abcdefgresource- URI of the resource
-
enableGovernanceRole
public final void enableGovernanceRole(String governanceRole, String subjectArea)
Description copied from interface:ClientConvenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.- Specified by:
enableGovernanceRolein interfaceClient- See Also:
EnableGovernanceRoleApiFunction.enableGovernanceRole(GovernanceRoleUri, GovernanceAreaUri)
-
enableGovernanceRole
public final void enableGovernanceRole(GovernanceRoleUri governanceRole, GovernanceAreaUri subjectArea)
Description copied from interface:EnableGovernanceRoleApiFunctionEnable a governance role.- Specified by:
enableGovernanceRolein interfaceEnableGovernanceRoleApiFunction- Parameters:
governanceRole- URI of the governance role e.g., http://edg.topbraid.solutions/model/dataStewardsubjectArea- URI of the governance subject area e.g., urn:x-tb-governance:test
-
executeSpinTemplate
public final String executeSpinTemplate(ExecuteSpinTemplateParameters parameters)
Description copied from interface:ExecuteSpinTemplateApiFunctionExecute a SPIN template.- Specified by:
executeSpinTemplatein interfaceExecuteSpinTemplateApiFunction- Parameters:
parameters- : parameters object- Returns:
- String comprising the body, encoded in the format specified in parameters
-
executeSwpViewClass
public final org.apache.http.client.methods.CloseableHttpResponse executeSwpViewClass(ExecuteSwpViewClassParameters parameters)
Description copied from interface:ExecuteSwpViewClassApiFunctionExecute an arbitrary SWP view class.- Specified by:
executeSwpViewClassin interfaceExecuteSwpViewClassApiFunction- Parameters:
parameters- parameters object- Returns:
- HTTP response; must be closed by the caller
-
executeSwpViewClassToString
public final String executeSwpViewClassToString(ExecuteSwpViewClassParameters parameters)
Description copied from interface:ExecuteSwpViewClassApiFunctionExecute an arbitrary SWP view class and return its response (body) as a String.- Specified by:
executeSwpViewClassToStringin interfaceExecuteSwpViewClassApiFunction- Parameters:
parameters- parameters object- Returns:
- the response body
-
exportToRdf
public final String exportToRdf(ExportToRdfParameters parameters)
Description copied from interface:ExportToRdfApiFunctionExport a project's contents to RDF.- Specified by:
exportToRdfin interfaceExportToRdfApiFunction- Parameters:
parameters- : parameters object- Returns:
- exported RDF as a String
-
getPlatformGraphqlConnection
public final TypedGraphqlConnection<RootRDFQueryQuery,RootRDFQuery> getPlatformGraphqlConnection()
Description copied from interface:GetPlatformGraphqlConnectionApiFunctionGet a GraphQL connection for the platform APIO.- Specified by:
getPlatformGraphqlConnectionin interfaceGetPlatformGraphqlConnectionApiFunction
-
getProjectGraphqlConnection
public final <RootQueryT extends AbstractQuery<RootQueryT>,RootResponseT extends AbstractResponse<RootResponseT>> TypedGraphqlConnection<RootQueryT,RootResponseT> getProjectGraphqlConnection(GetProjectGraphqlConnectionParameters<RootQueryT,RootResponseT> parameters)
Description copied from interface:GetProjectGraphqlConnectionApiFunctionGet a GraphQL connection for a specific project.- Specified by:
getProjectGraphqlConnectionin interfaceGetProjectGraphqlConnectionApiFunction
-
getRawGraphqlConnection
public final RawGraphqlConnection getRawGraphqlConnection(ProjectGraphUri projectGraphUri)
Description copied from interface:ClientConvenience method to get a raw GraphQL connection for a project.- Specified by:
getRawGraphqlConnectionin interfaceClient
-
getRawGraphqlConnection
public final RawGraphqlConnection getRawGraphqlConnection(ProjectGraphUri projectGraphUri, Optional<ProjectGraphqlSchemaType> projectGraphqlSchemaType)
Description copied from interface:ClientConvenience method to get a raw GraphQL connection for a project.- Specified by:
getRawGraphqlConnectionin interfaceClient
-
getRawGraphqlConnection
public final RawGraphqlConnection getRawGraphqlConnection(String endpointUrlPath)
Description copied from interface:GetRawGraphqlConnectionApiFunctionGet a raw GraphQL connection.- Specified by:
getRawGraphqlConnectionin interfaceGetRawGraphqlConnectionApiFunction- Parameters:
endpointUrlPath- relative endpoint URL path as /tbl/graphql/_
-
getSparqlConnection
public final org.apache.jena.rdfconnection.RDFConnection getSparqlConnection()
Description copied from interface:GetSparqlConnectionApiFunctionInteract with the server via SPARQL.- Specified by:
getSparqlConnectionin interfaceGetSparqlConnectionApiFunction
-
listProjects
public final com.google.common.collect.ImmutableList<ProjectGraphUri> listProjects()
Description copied from interface:ListProjectsApiFunctionList project graphs known to the server.- Specified by:
listProjectsin interfaceListProjectsApiFunction
-
querySparql
public final org.apache.jena.query.QueryExecution querySparql(org.apache.jena.query.Query query, Optional<String> defaultGraph)Description copied from interface:QuerySparqlApiFunctionQuery the EDG SPARQL endpoint.- Specified by:
querySparqlin interfaceQuerySparqlApiFunction- Parameters:
query- SPARQL querydefaultGraph- optional default graph URI- Returns:
- Jena QueryExecution, which must be closed by the caller
-
setGovernanceRolePermission
public final void setGovernanceRolePermission(String governanceArea, String governancePermission, String governanceRole)
Description copied from interface:ClientConvenience method that only uses built-in and Jena types, to make the client easier to use from languages besides Java.- Specified by:
setGovernanceRolePermissionin interfaceClient- See Also:
SetGovernanceAreaPermission.setGovernanceRolePermission(GovernanceAreaUri, GovernancePermission, GovernanceRoleUri)
-
setGovernanceRolePermission
public final void setGovernanceRolePermission(GovernanceAreaUri governanceArea, GovernancePermission governancePermission, GovernanceRoleUri governanceRole)
Description copied from interface:SetGovernanceAreaPermissionSet the permission of a governance role in a governance area.- Specified by:
setGovernanceRolePermissionin interfaceSetGovernanceAreaPermission
-
unzipProject
public final void unzipProject(Path projectZipFilePath, Optional<UnzipProjectApiFunction.OldProject> oldProject)
Description copied from interface:UnzipProjectApiFunctionUpload a project as a .zip file to the server.- Specified by:
unzipProjectin interfaceUnzipProjectApiFunction- Parameters:
projectZipFilePath- path to a .zip file containing the projectoldProject- delete or update an existing project
-
-