public abstract class EndpointBase extends Object implements Endpoint
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.
EndpointManager
Modifier and Type | Class and Description |
---|---|
static class |
EndpointBase.ManagedRepositoryConnection
A wrapper for managed
RepositoryConnection s which makes sure that EndpointBase.ManagedRepositoryConnection.close() is a no-op, i.e. |
Modifier and Type | Field and Description |
---|---|
protected String |
endpoint |
protected EndpointClassification |
endpointClassification |
protected EndpointConfiguration |
endpointConfiguration |
protected boolean |
initialized |
protected static org.slf4j.Logger |
log |
protected RepositoryInformation |
repoInfo |
protected TripleSource |
tripleSource |
protected boolean |
writable |
Constructor and Description |
---|
EndpointBase(RepositoryInformation repoInfo,
String endpoint,
EndpointClassification endpointClassification) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getRepository
protected static final org.slf4j.Logger log
protected final RepositoryInformation repoInfo
protected final String endpoint
protected EndpointClassification endpointClassification
protected boolean writable
protected boolean initialized
protected TripleSource tripleSource
protected EndpointConfiguration endpointConfiguration
public EndpointBase(RepositoryInformation repoInfo, String endpoint, EndpointClassification endpointClassification)
public String getName()
public TripleSource getTripleSource()
getTripleSource
in interface Endpoint
TripleSource
public EndpointClassification getEndpointClassification()
getEndpointClassification
in interface Endpoint
EndpointClassification
public void setEndpointClassification(EndpointClassification endpointClassification)
public boolean isLocal()
public boolean isWritable()
isWritable
in interface Endpoint
public RepositoryInformation getRepoInfo()
public void setWritable(boolean writable)
writable
- the writable to setpublic EndpointConfiguration getEndpointConfiguration()
Endpoint
getEndpointConfiguration
in interface Endpoint
public void setEndpointConfiguration(EndpointConfiguration endpointConfiguration)
endpointConfiguration
- the endpointConfiguration to setpublic RepositoryConnection getConnection()
Endpoint
RepositoryConnection
for the Repository
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 using CloseDependentConnectionIteration
.
getConnection
in interface Endpoint
protected RepositoryConnection getFreshConnection()
public String getId()
public String getEndpoint()
Endpoint
getEndpoint
in interface Endpoint
public EndpointType getType()
public boolean isInitialized()
isInitialized
in interface Endpoint
public long size() throws RepositoryException
Endpoint
size
in interface Endpoint
RepositoryException
public void init(FederationContext federationContext) throws RepositoryException
Endpoint
Endpoint
init
in interface Endpoint
RepositoryException
protected boolean useSingleConnection()
RepositoryConnection
throughout the lifetime of this Endpoint.
Note that the RepositoryConnection
is wrapped as EndpointBase.ManagedRepositoryConnection
public void shutDown() throws RepositoryException
Endpoint
Endpoint
shutDown
in interface Endpoint
RepositoryException
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.