Class JKAbstractDataSource

java.lang.Object
com.jk.data.datasource.impl.JKAbstractDataSource
All Implemented Interfaces:
Synchronizable, JKDataSource
Direct Known Subclasses:
JKHibernateDataSource

public abstract class JKAbstractDataSource extends Object implements JKDataSource
The Class JKAbstractDataSource.
  • Field Details

    • logger

      protected JKLogger logger
      The logger.
  • Constructor Details

    • JKAbstractDataSource

      public JKAbstractDataSource()
      Instantiates a new JK abstract data source.
    • JKAbstractDataSource

      public JKAbstractDataSource(String name, Properties properties)
      Instantiates a new JK abstract data source.
      Parameters:
      name - the name
      properties - the properties
  • Method Details

    • initProperties

      protected void initProperties(Properties properties)
      Inits the properties.
      Parameters:
      properties - the properties
    • fixProperties

      protected void fixProperties()
      Override config from properties.
    • processProperty

      protected void processProperty(Properties properties, String key, String value)
      Process property.
      Parameters:
      properties - the properties
      key - the key
      value - the value
    • init

      public abstract void init()
      Inits the.
      Specified by:
      init in interface JKDataSource
    • getName

      public String getName()
      Gets the name.
      Returns:
      the name
    • setName

      public void setName(String name)
      Sets the name.
      Parameters:
      name - the new name
    • getEntities

      public List<String> getEntities()
      Gets the entities.
      Returns:
      the entities
    • getEntities

      public List<String> getEntities(boolean initIfNull)
      Gets the entities.
      Parameters:
      initIfNull - the init if null
      Returns:
      the entities
    • getProperties

      public Properties getProperties()
      Gets the properties.
      Specified by:
      getProperties in interface JKDataSource
      Returns:
      the properties
    • cleanSpecificDatabaseResources

      protected void cleanSpecificDatabaseResources()
      Clean specific database resources.
    • close

      public void close(Connection con)
      Close.
      Specified by:
      close in interface JKDataSource
      Parameters:
      con - the con
    • close

      public void close(Connection connection, boolean commit)
      Close.
      Specified by:
      close in interface JKDataSource
      Parameters:
      connection - the connection
      commit - the commit
    • getConnection

      public Connection getConnection() throws JKDataAccessException
      Gets the connection.
      Specified by:
      getConnection in interface JKDataSource
      Returns:
      the connection
      Throws:
      JKDataAccessException - the JK data access exception
    • getClientInfoProperties

      public Properties getClientInfoProperties()
      Gets the client info properties.
      Returns:
      the client info properties
    • getEmf

      public jakarta.persistence.EntityManagerFactory getEmf()
      Gets the emf.
      Returns:
      the emf
    • setEmf

      protected void setEmf(jakarta.persistence.EntityManagerFactory emf)
      Sets the emf.
      Parameters:
      emf - the new emf
    • scanJpaEntities

      protected void scanJpaEntities()
      Adds the J pa entities.
    • getMaxAllowedConnections

      public int getMaxAllowedConnections()
      Gets the max allowed connections.
      Specified by:
      getMaxAllowedConnections in interface JKDataSource
      Returns:
      the max allowed connections
    • setProperty

      public void setProperty(String key, String value)
      Sets the property.
      Specified by:
      setProperty in interface JKDataSource
      Parameters:
      key - the key
      value - the value
    • isEntityAvailable

      public boolean isEntityAvailable(Class<?> clas)
      Checks if is entity available.
      Specified by:
      isEntityAvailable in interface JKDataSource
      Parameters:
      clas - the clas
      Returns:
      true, if is entity available
    • getDatabaseType

      public JKDatabase getDatabaseType()
      Gets the database type.
      Specified by:
      getDatabaseType in interface JKDataSource
      Returns:
      the database type
    • getConfig

      public JKConfig getConfig()
      Gets the config.
      Returns:
      the config
    • setPropertyIfNull

      protected void setPropertyIfNull(String property, String value)
      Sets the property if null.
      Parameters:
      property - the property
      value - the value
    • close

      public void close()
      Close.
      Specified by:
      close in interface JKDataSource
    • getQueryConnection

      public Connection getQueryConnection() throws JKDataAccessException
      Gets the query connection.
      Specified by:
      getQueryConnection in interface JKDataSource
      Returns:
      the query connection
      Throws:
      JKDataAccessException - the JK data access exception