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
Modifier and TypeClassDescriptionstatic class
A wrapper for managedRepositoryConnection
s which makes sure thatEndpointBase.ManagedRepositoryConnection.close()
is a no-op, i.e. -
Field Summary
Modifier and TypeFieldDescriptionprotected final String
protected EndpointClassification
protected EndpointConfiguration
protected boolean
protected static final org.slf4j.Logger
protected final RepositoryInformation
protected TripleSource
protected boolean
-
Constructor Summary
ConstructorDescriptionEndpointBase
(RepositoryInformation repoInfo, String endpoint, EndpointClassification endpointClassification) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Return aRepositoryConnection
for theRepository
represented by this endpoint.Get the endpoint location, e.g.Additional endpoint specific configuration.protected RepositoryConnection
getId()
getName()
getType()
int
hashCode()
void
init
(FederationContext federationContext) Initialize thisEndpoint
boolean
boolean
isLocal()
boolean
void
setEndpointClassification
(EndpointClassification endpointClassification) void
setEndpointConfiguration
(EndpointConfiguration endpointConfiguration) void
setWritable
(boolean writable) void
shutDown()
Shutdown thisEndpoint
long
size()
Returns the size of the given repository, i.e.toString()
protected boolean
Whether to reuse the sameRepositoryConnection
throughout the lifetime of this Endpoint.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:
getTripleSource
in interfaceEndpoint
- Returns:
- the
TripleSource
-
getEndpointClassification
- Specified by:
getEndpointClassification
in interfaceEndpoint
- Returns:
- the
EndpointClassification
-
setEndpointClassification
-
isLocal
public boolean isLocal() -
isWritable
public boolean isWritable()- Specified by:
isWritable
in 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:Endpoint
Additional endpoint specific configuration.- Specified by:
getEndpointConfiguration
in interfaceEndpoint
- Returns:
- the endpointConfiguration
-
setEndpointConfiguration
- Parameters:
endpointConfiguration
- the endpointConfiguration to set
-
getConnection
Description copied from interface:Endpoint
Return aRepositoryConnection
for theRepository
represented 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
RepositoryConnection
needs to stay open outside the scope of a method (e.g. for streaming results), consider usingCloseDependentConnectionIteration
.- Specified by:
getConnection
in interfaceEndpoint
- Returns:
- the repository connection
-
getFreshConnection
-
getId
-
getEndpoint
Description copied from interface:Endpoint
Get the endpoint location, e.g. for SPARQL endpoints the url- Specified by:
getEndpoint
in interfaceEndpoint
- Returns:
- the endpoint location
-
getType
-
isInitialized
public boolean isInitialized()- Specified by:
isInitialized
in interfaceEndpoint
- Returns:
- whether this Endpoint is initialized
-
size
Description copied from interface:Endpoint
Returns the size of the given repository, i.e. the number of triples.- Specified by:
size
in interfaceEndpoint
- Returns:
- the size of the endpoint
- Throws:
RepositoryException
-
init
Description copied from interface:Endpoint
Initialize thisEndpoint
- Specified by:
init
in interfaceEndpoint
- Parameters:
federationContext
-- Throws:
RepositoryException
-
useSingleConnection
protected boolean useSingleConnection()Whether to reuse the sameRepositoryConnection
throughout the lifetime of this Endpoint.Note that the
RepositoryConnection
is wrapped asEndpointBase.ManagedRepositoryConnection
- Returns:
- indicator whether a single connection should be used
-
shutDown
Description copied from interface:Endpoint
Shutdown thisEndpoint
- Specified by:
shutDown
in interfaceEndpoint
- Throws:
RepositoryException
-
hashCode
-
equals
-
toString
-