Module is.codion.framework.db.core
Package is.codion.framework.db
Class AbstractEntityConnectionProvider
java.lang.Object
is.codion.framework.db.AbstractEntityConnectionProvider
- All Implemented Interfaces:
EntityConnectionProvider,AutoCloseable
public abstract class AbstractEntityConnectionProvider
extends Object
implements EntityConnectionProvider
An abstract EntityConnectionProvider implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAbstractEntityConnectionProvider.AbstractBuilder<T extends EntityConnectionProvider,B extends EntityConnectionProvider.Builder<T, B>> Nested classes/interfaces inherited from interface is.codion.framework.db.EntityConnectionProvider
EntityConnectionProvider.Builder<T extends EntityConnectionProvider,B extends EntityConnectionProvider.Builder<T, B>> -
Field Summary
Fields inherited from interface is.codion.framework.db.EntityConnectionProvider
CLIENT_CONNECTION_TYPE, CLIENT_DOMAIN_TYPE, CONNECTION_TYPE_HTTP, CONNECTION_TYPE_LOCAL, CONNECTION_TYPE_REMOTE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddOnConnectListener(Consumer<EntityConnection> listener) Adds a listener notified each time this connection provider establishes a connection to the databasefinal UUIDclientId()final Stringfinal is.codion.common.version.Versionfinal voidclose()Closes the underlying connection and performs cleanup if requiredprotected abstract voidclose(EntityConnection connection) Closes the given connectionprotected abstract EntityConnectionconnect()final EntityConnectionProvides a EntityConnection object, is responsible for returning a healthy EntityConnection object, that is, it must reconnect an invalid connection whether remotely or locallyfinal booleanfinal is.codion.framework.domain.DomainTypefinal is.codion.framework.domain.entity.Entitiesentities()Returns the domain entities this connection is based onfinal voidremoveOnConnectListener(Consumer<EntityConnection> listener) Removes the given listenerfinal is.codion.common.user.Useruser()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface is.codion.framework.db.EntityConnectionProvider
connectionType, description
-
Constructor Details
-
AbstractEntityConnectionProvider
protected AbstractEntityConnectionProvider(AbstractEntityConnectionProvider.AbstractBuilder<?, ?> builder)
-
-
Method Details
-
entities
public final is.codion.framework.domain.entity.Entities entities()Description copied from interface:EntityConnectionProviderReturns the domain entities this connection is based on- Specified by:
entitiesin interfaceEntityConnectionProvider- Returns:
- the underlying domain entities
-
user
public final is.codion.common.user.User user()- Specified by:
userin interfaceEntityConnectionProvider- Returns:
- the user used by this connection provider
-
domainType
public final is.codion.framework.domain.DomainType domainType()- Specified by:
domainTypein interfaceEntityConnectionProvider- Returns:
- the domain type
-
clientId
- Specified by:
clientIdin interfaceEntityConnectionProvider- Returns:
- the UUID identifying this client connection
-
clientTypeId
- Specified by:
clientTypeIdin interfaceEntityConnectionProvider- Returns:
- the String identifying the client type for this connection provider
-
clientVersion
public final is.codion.common.version.Version clientVersion()- Specified by:
clientVersionin interfaceEntityConnectionProvider- Returns:
- the client version
-
connectionValid
public final boolean connectionValid()- Specified by:
connectionValidin interfaceEntityConnectionProvider- Returns:
- true if a connection has been establised and the connection is in a valid state
-
addOnConnectListener
Description copied from interface:EntityConnectionProviderAdds a listener notified each time this connection provider establishes a connection to the database- Specified by:
addOnConnectListenerin interfaceEntityConnectionProvider- Parameters:
listener- a listener notified when a connection is established
-
removeOnConnectListener
Description copied from interface:EntityConnectionProviderRemoves the given listener- Specified by:
removeOnConnectListenerin interfaceEntityConnectionProvider- Parameters:
listener- the listener to remove
-
connection
Description copied from interface:EntityConnectionProviderProvides a EntityConnection object, is responsible for returning a healthy EntityConnection object, that is, it must reconnect an invalid connection whether remotely or locally- Specified by:
connectionin interfaceEntityConnectionProvider- Returns:
- a EntityConnection instance
-
close
public final void close()Description copied from interface:EntityConnectionProviderCloses the underlying connection and performs cleanup if required- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceEntityConnectionProvider- See Also:
-
connect
- Returns:
- an established connection
-
close
Closes the given connection- Parameters:
connection- the connection to be closed
-