001package io.ebean.plugin;
002
003import io.ebean.Database;
004import io.ebean.bean.BeanLoader;
005import io.ebean.bean.EntityBeanIntercept;
006import io.ebean.config.DatabaseConfig;
007import io.ebean.config.dbplatform.DatabasePlatform;
008
009import java.util.List;
010
011/**
012 * Extensions to Database API made available to plugins.
013 */
014public interface SpiServer extends Database {
015
016  /**
017   * Return the DatabaseConfig.
018   */
019  DatabaseConfig getServerConfig();
020
021  /**
022   * Return the DatabasePlatform for this database.
023   */
024  DatabasePlatform getDatabasePlatform();
025
026  /**
027   * Return all the bean types registered on this server instance.
028   */
029  List<? extends BeanType<?>> getBeanTypes();
030
031  /**
032   * Return the bean type for a given entity bean class.
033   */
034  <T> BeanType<T> getBeanType(Class<T> beanClass);
035
036  /**
037   * Return the bean types mapped to the given base table.
038   */
039  List<? extends BeanType<?>> getBeanTypes(String baseTableName);
040
041  /**
042   * Return the bean type for a given doc store queueId.
043   */
044  BeanType<?> getBeanTypeForQueueId(String queueId);
045
046  /**
047   * Return a BeanLoader.
048   */
049  BeanLoader beanLoader();
050
051  /**
052   * Invoke lazy loading on this single bean (reference bean).
053   */
054  void loadBeanRef(EntityBeanIntercept ebi);
055
056  /**
057   * Invoke lazy loading on this single bean (L2 cache bean).
058   */
059  void loadBeanL2(EntityBeanIntercept ebi);
060
061  /**
062   * Invoke lazy loading on this single bean when no BeanLoader is set.
063   * Typically due to serialisation or multiple stateless updates.
064   */
065  void loadBean(EntityBeanIntercept ebi);
066}