Ejemplo n.º 1
0
  /** Constructor private because singleton class */
  private ApiKeyManager() {
    // Set the name of the db to get the data from.
    // Use the db name, such as "web".
    dbName = DbSetupConfig.getDbName();

    // Create the cache. Cache will actually be populated when first
    // checking if key is valid. This way don't do a db read at startup.
    apiKeyCache = new HashMap<String, ApiKey>();
  }
Ejemplo n.º 2
0
 /**
  * Specifies name of database to use for reading in the WebAgency objects. Currently using the
  * command line option transitime.core.agencyId .
  *
  * @return Name of db to retrieve WebAgency objects from
  */
 private static String getWebAgencyDbName() {
   return DbSetupConfig.getDbName();
 }
Ejemplo n.º 3
0
 /**
  * Gets the API keys from the database. Gets the session for db access. The session is specified
  * by parameters in CoreConfig including CoreConfig.getAgencyId() for the name of the database
  * (such as "web") and CoreConfig.getDbHost(), CoreConfig.getDbUserName(), and
  * CoreConfig.getDbPassword(). The db host, user name, and password can also be set in the
  * hibernate.cfg.xml file if the parameter transitime.hibernate.configFile in the CoreConfig is
  * set.
  *
  * @return
  */
 public List<ApiKey> getApiKeys() {
   Session session = HibernateUtils.getSession(DbSetupConfig.getDbName());
   return ApiKey.getApiKeys(session);
 }