Creates the DAO if we have config information cached and caches the DAO.
324418
private static <D, T> D createDaoFromConfig(ConnectionSource connectionSource, Class<T> clazz) throws SQLException {
		// no loaded configs
		if (configMap == null) {
			return null;
		}

		@SuppressWarnings("unchecked")
		DatabaseTableConfig<T> config = (DatabaseTableConfig<T>) configMap.get(clazz);
		// if we don't config information cached return null
		if (config == null) {
			return null;
		}

		// else create a DAO using configuration
		Dao<T, ?> configedDao = doCreateDao(connectionSource, config);
		@SuppressWarnings("unchecked")
		D castDao = (D) configedDao;
		return castDao;
	}
159677
public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) {
		if (connectionSource == null) {
			throw new IllegalArgumentException("connectionSource argument cannot be null");
		}
		ClassConnectionSource key = new ClassConnectionSource(connectionSource, clazz);
		Dao<?, ?> dao = lookupDao(key);
		@SuppressWarnings("unchecked")
		D castDao = (D) dao;
		return castDao;
	}
1322640
@PostConstruct
  public void initialize() {

    if (this.initialized) {
      return;
    }
    LOG.debug("Initializing.");
    if (this.accessControlSchemaMapper == null) {
      this.accessControlSchemaMapper = new AccessControlSchemaXmlMapper();
    }
    if (this.accessControlSchema == null) {

      this.accessControlSchema = new ClassPathResource("config/app/security/access-control-schema.xml");
    }
    this.initialized = true;
  }
446025
public static synchronized void clearDaoCache() {
		if (classMap != null) {
			classMap.clear();
			classMap = null;
		}
		if (tableConfigMap != null) {
			tableConfigMap.clear();
			tableConfigMap = null;
		}
	}
18624
protected void generateDao(DaoDesc daoDesc) {
    File javaFile = FileUtil.createJavaFile(daoConfig.getDestDir(), daoDesc.getQualifiedName());
    GenerationContext context =
        new GenerationContext(
            daoDesc,
            javaFile,
            daoDesc.getTemplateName(),
            daoConfig.getEncoding(),
            daoConfig.isOverwrite());
    generator.generate(context);
  }
838063
public <D extends Dao<T, ?>, T> D getDao(Class<T> clazz) throws SQLException {
		// special reflection fu is now handled internally by create dao calling the database type
		Dao<T, ?> dao = DaoManager.createDao(getConnectionSource(), clazz);
		@SuppressWarnings("unchecked")
		D castDao = (D) dao;
		return castDao;
	}
727140
public void initAtStartup() {
        //final String appsToInit = ConfigurationManager.getConfigInstance().getString("evcache.appsToInit");
        final String appsToInit = EVCacheConfig.getInstance().getDynamicStringProperty("evcache.appsToInit", "").get();
        if (appsToInit != null && appsToInit.length() > 0) {
            final StringTokenizer apps = new StringTokenizer(appsToInit, ",");
            while (apps.hasMoreTokens()) {
                final String app = getAppName(apps.nextToken());
                if (log.isDebugEnabled()) log.debug("Initializing EVCache - " + app);
                initEVCache(app);
            }
        }
    }
27679
public static void initialize()
    {
        if (InfinispanCache.get().exists(Role.UUIDCACHE)) {
            InfinispanCache.get().<UUID, Role>getCache(Role.UUIDCACHE).clear();
        } else {
            InfinispanCache.get().<UUID, Role>getCache(Role.UUIDCACHE).addListener(new CacheLogListener(Role.LOG));
        }
        if (InfinispanCache.get().exists(Role.IDCACHE)) {
            InfinispanCache.get().<Long, Role>getCache(Role.IDCACHE).clear();
        } else {
            InfinispanCache.get().<Long, Role>getCache(Role.IDCACHE).addListener(new CacheLogListener(Role.LOG));
        }
        if (InfinispanCache.get().exists(Role.NAMECACHE)) {
            InfinispanCache.get().<String, Role>getCache(Role.NAMECACHE).clear();
        } else {
            InfinispanCache.get().<String, Role>getCache(Role.NAMECACHE).addListener(new CacheLogListener(Role.LOG));
        }
    }
447481
public static <T, ID> RuntimeExceptionDao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz)
			throws SQLException {
		@SuppressWarnings("unchecked")
		Dao<T, ID> castDao = (Dao<T, ID>) DaoManager.createDao(connectionSource, clazz);
		return new RuntimeExceptionDao<T, ID>(castDao);
	}
165297
public DAOArray fromDao(DAO[] daoList) throws DAOArrayException{
		for(DAO dao : daoList){
			add(dao);
		}
		return this;
	}
716634
public static void initialize()
    {
        if (InfinispanCache.get().exists(AccessCache.PERMISSIONCACHE)) {
            InfinispanCache.get().<UUID, AccessType>getCache(AccessCache.PERMISSIONCACHE).clear();
        } else {
            InfinispanCache.get().<UUID, AccessType>getCache(AccessCache.PERMISSIONCACHE)
                            .addListener(new CacheLogListener(AccessCache.LOG));
        }
        if (InfinispanCache.get().exists(AccessCache.STATUSCACHE)) {
            InfinispanCache.get().<Long, AccessType>getCache(AccessCache.STATUSCACHE).clear();
        } else {
            InfinispanCache.get().<Long, AccessType>getCache(AccessCache.STATUSCACHE)
                            .addListener(new CacheLogListener(AccessCache.LOG));
        }
    }
325056
function init(){
    try {
      self.db = new nodeCache();
      log(false, 'Node-cache client created with the following defaults:', {expiration: this.expiration, verbose: this.verbose, readOnly: this.readOnly});
    } catch (err) {
      log(true, 'Node-cache client not created:', err);
      self.db = false;
    }
    self.type = config.type || 'node-cache';
  }
405296
public static <T> int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig)
			throws SQLException {
		Dao<T, ?> dao = DaoManager.createDao(connectionSource, tableConfig);
		return doCreateTable(dao, true);
	}
90417
public static synchronized void init(Configuration conf) {
    if (!initDone) {
      DefaultConfiguration.conf = conf;
      DefaultConfiguration.initDone = true;
    }
  }
738782
@SuppressWarnings("unchecked")
    private PojoDao<?> createPojoDaoInternal(CacheKey cacheKey) {
        DefaultPojoDao<?> dao = new DefaultPojoDao<>(session, cacheKey.getBinding(), cacheKey.getTableName(), statementFactory, contextFactory, executor);
        listeners.forEach(listener -> listener.pojoDaoCreated(new PojoDaoFactoryEvent<>((PojoDao<Object>) dao, (PojoBinding<Object>) cacheKey.getBinding(), cacheKey.getTableName())));
        return dao;
    }
623838
private void generateOnConfigure(boolean useForeignKey) {
		// onConfigure

		MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("onConfigure").addAnnotation(Override.class)
				.addModifiers(Modifier.PUBLIC);
		methodBuilder.addParameter(SQLiteDatabase.class, "database");
		methodBuilder.addJavadoc("onConfigure\n");
		methodBuilder.addCode("// configure database\n");

		if (useForeignKey) {
			methodBuilder.addStatement("database.setForeignKeyConstraintsEnabled(true)");
		}

		methodBuilder.beginControlFlow("if (options.databaseLifecycleHandler != null)");
		methodBuilder.addStatement("options.databaseLifecycleHandler.onConfigure(database)");
		methodBuilder.endControlFlow();

		classBuilder.addMethod(methodBuilder.build());
	}
697016
public static void initialize()
    {
        if (InfinispanCache.get().exists(Association.IDCACHE)) {
            InfinispanCache.get().<Long, Association>getCache(Association.IDCACHE).clear();
        } else {
            InfinispanCache.get().<Long, Association>getCache(Association.IDCACHE)
                            .addListener(new CacheLogListener(Association.LOG));
        }
    }