Class FederationDescriptionReader
java.lang.Object
se.liu.ida.hefquin.federation.catalog.FederationDescriptionReader
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected FederationMembercreateBRTPFServer(org.apache.jena.graph.Node serviceURI, String uri, AuthenticationInformation authInfo, VocabularyMapping vm) protected FederationMembercreateFederationMember(org.apache.jena.rdf.model.Resource fedMember, org.apache.jena.graph.Node serviceURI, org.apache.jena.rdf.model.Model fd) protected FederationMembercreateGraphQLServer(org.apache.jena.graph.Node serviceURI, String uri, AuthenticationInformation authInfo) protected FederationMembercreateNeo4jServer(org.apache.jena.graph.Node serviceURI, String uri, AuthenticationInformation authInfo) protected FederationMembercreateSPARQLEndpoint(org.apache.jena.graph.Node serviceURI, String uri, AuthenticationInformation authInfo, VocabularyMapping vm) protected FederationMembercreateTPFServer(org.apache.jena.graph.Node serviceURI, String uri, AuthenticationInformation authInfo, VocabularyMapping vm) protected FederationMembercreateWrappedRESTEndpoint(org.apache.jena.graph.Node serviceURI, String uri, List<RESTEndpoint.Parameter> params, AuthenticationInformation authInfo, Integer parallelRequestLimit, List<MappingExpression> trMaps) protected StringgetAsURIString(org.apache.jena.rdf.model.RDFNode n) Returns a string that represents a URI obtained from the given RDF node.protected StringgetRequiredEnvironmentVariable(String variableName) Retrieves the value of the specified environment variable and throws an exception if the variable is not set.protected StringgetSingleURIProperty(org.apache.jena.rdf.model.Resource iface, org.apache.jena.rdf.model.Property p, String errorMsg1, String errorMsg2) Returns the single URI value of the given property from the resource.protected FederationMemberhandleFixedEndpointInterface(org.apache.jena.rdf.model.Resource iface, org.apache.jena.rdf.model.Resource protocol, AuthenticationInformation authInfo, VocabularyMapping vocabMap, Integer parallelRequestLimit, org.apache.jena.rdf.model.Resource fedMember, org.apache.jena.rdf.model.Model fd, org.apache.jena.graph.Node serviceURI) Creates a federation member for a fixed endpoint interface (SPARQL, Bolt, GraphQL).protected FederationMemberhandleFragmentInterface(org.apache.jena.rdf.model.Resource iface, org.apache.jena.rdf.model.Resource protocol, AuthenticationInformation authInfo, VocabularyMapping vocabMap, Integer parallelRequestLimit, org.apache.jena.graph.Node serviceURI) Creates a federation member for a fragment interface (TPF, brTPF).protected FederationMemberhandleTemplateInterface(org.apache.jena.rdf.model.Resource iface, org.apache.jena.rdf.model.Resource protocol, AuthenticationInformation authInfo, VocabularyMapping vocabMap, Integer parallelRequestLimit, org.apache.jena.rdf.model.Resource fedMember, org.apache.jena.rdf.model.Model fd, org.apache.jena.graph.Node serviceURI) Creates a federation member for a template-based interface, including parameter and mapping handling.protected AuthenticationInformationparseAuthConfig(org.apache.jena.rdf.model.Resource iface, org.apache.jena.rdf.model.Model fd) Parses the authentication configuration associated with the given interface.parseFedDescr(String filename) parseFedDescr(List<String> filenames) parseFedDescr(org.apache.jena.rdf.model.Model fd) protected List<MappingExpression> parseRMLMapping(org.apache.jena.rdf.model.Resource fedMember, org.apache.jena.rdf.model.Model fd, org.apache.jena.graph.Node serviceURI) protected VocabularyMappingparseVocabMapping(org.apache.jena.rdf.model.Resource fm, org.apache.jena.rdf.model.Model fd) Attempts to retrieve and parse the vocabulary mapping associated with the given RDF resourcefm, representing aFederationMember, in the given federation descriptionfd.static FederationCatalogreadFromFile(String filename) static FederationCatalogreadFromFiles(List<String> filenames) static FederationCatalogreadFromModel(org.apache.jena.rdf.model.Model fd) static FederationCatalogreadFromModels(List<org.apache.jena.rdf.model.Model> fds) protected voidrequireHeaderBasedAuthentication(org.apache.jena.rdf.model.Resource securityScheme, String authenticationType) Checks whether the given security scheme specifies HTTP headers as the location for authentication information.protected URIverifyExpectedURI(String uriString) Verifies that the given string represents an HTTP URI or an HTTPS URI and, if so, returns that URI.
-
Field Details
-
instance
-
-
Constructor Details
-
FederationDescriptionReader
protected FederationDescriptionReader()
-
-
Method Details
-
readFromFile
-
readFromFiles
-
readFromModel
-
readFromModels
-
parseFedDescr
-
parseFedDescr
-
parseFedDescr
-
createFederationMember
protected FederationMember createFederationMember(org.apache.jena.rdf.model.Resource fedMember, org.apache.jena.graph.Node serviceURI, org.apache.jena.rdf.model.Model fd) -
parseVocabMapping
protected VocabularyMapping parseVocabMapping(org.apache.jena.rdf.model.Resource fm, org.apache.jena.rdf.model.Model fd) Attempts to retrieve and parse the vocabulary mapping associated with the given RDF resourcefm, representing aFederationMember, in the given federation descriptionfd. The method attempts to load the vocabulary mapping from the specified path or URL and caches the result for reuse. If no vocabulary mappings file is present, the method returnsnull.- Parameters:
fm- RDF resource for the federation memberfd- RDF model of the federation description- Returns:
- parsed
VocabularyMapping, ornullif not specified - Throws:
IllegalArgumentException- if the mapping file cannot be loaded or parsed
-
handleFixedEndpointInterface
protected FederationMember handleFixedEndpointInterface(org.apache.jena.rdf.model.Resource iface, org.apache.jena.rdf.model.Resource protocol, AuthenticationInformation authInfo, VocabularyMapping vocabMap, Integer parallelRequestLimit, org.apache.jena.rdf.model.Resource fedMember, org.apache.jena.rdf.model.Model fd, org.apache.jena.graph.Node serviceURI) Creates a federation member for a fixed endpoint interface (SPARQL, Bolt, GraphQL). -
handleFragmentInterface
protected FederationMember handleFragmentInterface(org.apache.jena.rdf.model.Resource iface, org.apache.jena.rdf.model.Resource protocol, AuthenticationInformation authInfo, VocabularyMapping vocabMap, Integer parallelRequestLimit, org.apache.jena.graph.Node serviceURI) Creates a federation member for a fragment interface (TPF, brTPF). -
handleTemplateInterface
protected FederationMember handleTemplateInterface(org.apache.jena.rdf.model.Resource iface, org.apache.jena.rdf.model.Resource protocol, AuthenticationInformation authInfo, VocabularyMapping vocabMap, Integer parallelRequestLimit, org.apache.jena.rdf.model.Resource fedMember, org.apache.jena.rdf.model.Model fd, org.apache.jena.graph.Node serviceURI) Creates a federation member for a template-based interface, including parameter and mapping handling. -
parseRMLMapping
protected List<MappingExpression> parseRMLMapping(org.apache.jena.rdf.model.Resource fedMember, org.apache.jena.rdf.model.Model fd, org.apache.jena.graph.Node serviceURI) -
parseAuthConfig
protected AuthenticationInformation parseAuthConfig(org.apache.jena.rdf.model.Resource iface, org.apache.jena.rdf.model.Model fd) Parses the authentication configuration associated with the given interface.Currently, both
wotsec:BearerSecuritySchemeandwotsec:BasicSecuritySchemeare supported. For bearer authentication, the environment variable containing the token is specified usingfd:envarForToken. For basic authentication, the environment variables containing the username and password are specified usingfd:envarForUsernameandfd:envarForPassword. Only header-based authentication is supported.- Parameters:
iface- the interface resource whose authentication configuration should be parsedfd- the federation description model- Returns:
- the parsed authentication information, or
nullif no security configuration is specified - Throws:
IllegalArgumentException- if the security configuration is not a resource, the required environment variable is not set, or the security scheme is not supported
-
createSPARQLEndpoint
protected FederationMember createSPARQLEndpoint(org.apache.jena.graph.Node serviceURI, String uri, AuthenticationInformation authInfo, VocabularyMapping vm) -
createTPFServer
protected FederationMember createTPFServer(org.apache.jena.graph.Node serviceURI, String uri, AuthenticationInformation authInfo, VocabularyMapping vm) -
createBRTPFServer
protected FederationMember createBRTPFServer(org.apache.jena.graph.Node serviceURI, String uri, AuthenticationInformation authInfo, VocabularyMapping vm) -
createNeo4jServer
protected FederationMember createNeo4jServer(org.apache.jena.graph.Node serviceURI, String uri, AuthenticationInformation authInfo) -
createGraphQLServer
protected FederationMember createGraphQLServer(org.apache.jena.graph.Node serviceURI, String uri, AuthenticationInformation authInfo) -
createWrappedRESTEndpoint
protected FederationMember createWrappedRESTEndpoint(org.apache.jena.graph.Node serviceURI, String uri, List<RESTEndpoint.Parameter> params, AuthenticationInformation authInfo, Integer parallelRequestLimit, List<MappingExpression> trMaps) -
getSingleURIProperty
protected String getSingleURIProperty(org.apache.jena.rdf.model.Resource iface, org.apache.jena.rdf.model.Property p, String errorMsg1, String errorMsg2) Returns the single URI value of the given property from the resource. Throws an exception if the property is missing, occurs more than once or is not a valid URI. -
verifyExpectedURI
-
getAsURIString
Returns a string that represents a URI obtained from the given RDF node. In particular, if the node is a URI, then that URI is returned (as a string); if the node is an xsd:anyURI literal with a valid URI as its lexical form, then that URI is returned; otherwise,nullis returned (including for the case that the given node is alreadynull). -
requireHeaderBasedAuthentication
protected void requireHeaderBasedAuthentication(org.apache.jena.rdf.model.Resource securityScheme, String authenticationType) Checks whether the given security scheme specifies HTTP headers as the location for authentication information. -
getRequiredEnvironmentVariable
Retrieves the value of the specified environment variable and throws an exception if the variable is not set.- Parameters:
variableName- the name of the environment variable- Returns:
- the value of the environment variable
- Throws:
IllegalArgumentException- if the environment variable is not set
-