Class EndpointBase
java.lang.Object
org.eclipse.rdf4j.federated.endpoint.EndpointBase
- All Implemented Interfaces:
Endpoint
- Direct Known Subclasses:
RepositoryEndpoint,ResolvableEndpoint
Base implementation for an
Endpoint.
Provides implementation for the common behavior as well as connection management. Typically a fresh
RepositoryConnection is returned when invoking getConnection(), however, it is configurable that a
managed (singleton) connection can be used.
- Author:
- Andreas Schwarte
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA wrapper for managedRepositoryConnections which makes sure thatEndpointBase.ManagedRepositoryConnection.close()is a no-op, i.e. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected EndpointClassificationprotected EndpointConfigurationprotected booleanprotected static final org.slf4j.Loggerprotected final RepositoryInformationprotected TripleSourceprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionEndpointBase(RepositoryInformation repoInfo, String endpoint, EndpointClassification endpointClassification) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturn aRepositoryConnectionfor theRepositoryrepresented by this endpoint.Get the endpoint location, e.g.Additional endpoint specific configuration.protected RepositoryConnectiongetId()getName()getType()inthashCode()voidinit(FederationContext federationContext) Initialize thisEndpointbooleanbooleanisLocal()booleanvoidsetEndpointClassification(EndpointClassification endpointClassification) voidsetEndpointConfiguration(EndpointConfiguration endpointConfiguration) voidsetWritable(boolean writable) voidshutDown()Shutdown thisEndpointlongsize()Returns the size of the given repository, i.e.toString()protected booleanWhether to reuse the sameRepositoryConnectionthroughout the lifetime of this Endpoint.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.rdf4j.federated.endpoint.Endpoint
getRepository
-
Field Details
-
log
protected static final org.slf4j.Logger log -
repoInfo
-
endpoint
-
endpointClassification
-
writable
protected boolean writable -
initialized
protected boolean initialized -
tripleSource
-
endpointConfiguration
-
-
Constructor Details
-
EndpointBase
public EndpointBase(RepositoryInformation repoInfo, String endpoint, EndpointClassification endpointClassification)
-
-
Method Details
-
getName
-
getTripleSource
- Specified by:
getTripleSourcein interfaceEndpoint- Returns:
- the
TripleSource
-
getEndpointClassification
- Specified by:
getEndpointClassificationin interfaceEndpoint- Returns:
- the
EndpointClassification
-
setEndpointClassification
-
isLocal
public boolean isLocal() -
isWritable
public boolean isWritable()- Specified by:
isWritablein interfaceEndpoint- Returns:
- whether this endpoint is writable
-
getRepoInfo
-
setWritable
public void setWritable(boolean writable) - Parameters:
writable- the writable to set
-
getEndpointConfiguration
Description copied from interface:EndpointAdditional endpoint specific configuration.- Specified by:
getEndpointConfigurationin interfaceEndpoint- Returns:
- the endpointConfiguration
-
setEndpointConfiguration
- Parameters:
endpointConfiguration- the endpointConfiguration to set
-
getConnection
Description copied from interface:EndpointReturn aRepositoryConnectionfor theRepositoryrepresented by this endpoint.Callers of this method need to ensure to close the connection after use.
Typical pattern:
try (RepositoryConnection conn = endpoint.getConnection()) { // do something with the connection }If the
RepositoryConnectionneeds to stay open outside the scope of a method (e.g. for streaming results), consider usingCloseDependentConnectionIteration.- Specified by:
getConnectionin interfaceEndpoint- Returns:
- the repository connection
-
getFreshConnection
-
getId
-
getEndpoint
Description copied from interface:EndpointGet the endpoint location, e.g. for SPARQL endpoints the url- Specified by:
getEndpointin interfaceEndpoint- Returns:
- the endpoint location
-
getType
-
isInitialized
public boolean isInitialized()- Specified by:
isInitializedin interfaceEndpoint- Returns:
- whether this Endpoint is initialized
-
size
Description copied from interface:EndpointReturns the size of the given repository, i.e. the number of triples.- Specified by:
sizein interfaceEndpoint- Returns:
- the size of the endpoint
- Throws:
RepositoryException
-
init
Description copied from interface:EndpointInitialize thisEndpoint- Specified by:
initin interfaceEndpoint- Throws:
RepositoryException
-
useSingleConnection
protected boolean useSingleConnection()Whether to reuse the sameRepositoryConnectionthroughout the lifetime of this Endpoint.Note that the
RepositoryConnectionis wrapped asEndpointBase.ManagedRepositoryConnection- Returns:
- indicator whether a single connection should be used
-
shutDown
Description copied from interface:EndpointShutdown thisEndpoint- Specified by:
shutDownin interfaceEndpoint- Throws:
RepositoryException
-
hashCode
public int hashCode() -
equals
-
toString
-