protected String filterEnvSwitching(String path) { return LastaDiProperties.getInstance().resolveLastaEnvPath(path); }
public static LastaDiProperties getInstance() { if (instance == null) { synchronized (LastaDiProperties.class) { if (instance == null) { instance = new LastaDiProperties(); } } } return instance; }
public String getSmartPackage2() { return getProperty(SMART_PACKAGE2_KEY); }
protected boolean isInternalDebug() { if (internalDebug == null) { synchronized (ScriptingExpression.class) { if (internalDebug == null) { // almost no cost but cache just in case internalDebug = LastaDiProperties.getInstance().isInternalDebug(); } } } return internalDebug; } }
String realMode = null; for (String propName : propList) { // e.g. [orleans_env.properties, maihana_env.properties] final String resolvedName = resolveLastaEnvPath(propName); // e.g. maihana_env_production.properties logger.info("...Loading specified properties and get by the key: {}, {}", resolvedName, modeKey); final Properties read = loadProperties(resolvedName); if (read == null) { throwSmartDeployPropertiesFileNotFoundException(location, resolvedName, modeKey); throwSmartDeployPropertiesModeKeyNotFoundException(location, propExp, modeKey);
protected static void setupScriptEngine() { new Thread(() -> { /* first getEngineByName() costs about 0.5 seconds so initialize it background */ final Class<?> engineType = LastaDiProperties.getInstance().getDiXmlScriptExpressionEngineType(); if (engineType == null) { /* use default */ new ScriptEngineManager().getEngineByName("javascript"); /* initialize static resources */ } }).start(); }
protected void setupPropertiesSmartPackage() { LastaDiProperties.getInstance().getSmartPackageList().forEach(pkg -> { addRootPackageName(pkg); }); }
protected boolean needsPlainPropertyInjection(PropertyDesc propDesc) { final Method writeMethod = propDesc.getWriteMethod(); if (writeMethod == null) { // e.g. getter only or public field, are out of target return false; } // the property has setter final String fqcn = writeMethod.getDeclaringClass().getName(); if (fqcn.startsWith("org.lastaflute.") || fqcn.startsWith("org.dbflute.")) { return true; } final String specified1 = LastaDiProperties.getInstance().getPlainPropertyInjectionPackage1(); if (specified1 != null && fqcn.startsWith(specified1)) { return true; } return false; } }
protected static void setupSmartDeployMode() { final String smartDeployMode = LastaDiProperties.getInstance().getSmartDeployMode(); if (smartDeployMode != null) { SmartDeployMode.setValue(SmartDeployMode.codeOf(smartDeployMode)); // with logging } else { logger.info("*Not found smart deploy mode property so use default mode: {}", SmartDeployMode.getValue()); } }
public String getSmartDeployMode() { if (smartDeployMode != null || smartDeployLocationDone) { return smartDeployMode; } synchronized (this) { if (smartDeployMode != null || smartDeployLocationDone) { return smartDeployMode; } final String locKey = SMART_DEPLOY_MODE_LOCATION_KEY; final String location = getProperty(locKey); if (location != null && !location.isEmpty()) { smartDeployMode = deriveSmartDeployModeFromLocation(location); } else { logger.info("*Not found the smart-deploy mode location: {} in {}", locKey, LASTA_DI_PROPERTIES); } smartDeployLocationDone = true; return smartDeployMode; } }
public Class<?> getDiXmlScriptExpressionEngineType() { // null allowed if (diXmlScriptExpressionEngineType == null && !diXmlScriptExpressionEngineTypeDone) { synchronized (this) { if (diXmlScriptExpressionEngineType == null) { final String engineName = getDiXmlScriptExpressionEngine(); if (engineName != null) { // #hope jflute lastaflute: [E] fitting: DI :: expression engine creation error handling diXmlScriptExpressionEngineType = LdiClassUtil.forName(engineName); } diXmlScriptExpressionEngineTypeDone = true; } } } return diXmlScriptExpressionEngineType; }
public String resolveLastaEnvPath(String envPath) { if (envPath == null) { throw new IllegalArgumentException("The argument 'envPath' should not be null."); } final String lastaEnv = getLastaEnv(); if (lastaEnv != null && envPath.contains("_env.")) { // e.g. maihama_env.properties to maihama_env_prod.properties final String front = LdiSrl.substringLastFront(envPath, "_env."); final String rear = LdiSrl.substringLastRear(envPath, "_env."); return front + "_env_" + lastaEnv + "." + rear; } else { return envPath; } }
protected boolean isInternalDebug() { return LastaDiProperties.getInstance().isInternalDebug(); }
protected ExpressionEngine prepareEngine() { final Class<?> engineType = LastaDiProperties.getInstance().getDiXmlScriptExpressionEngineType(); final ExpressionEngine engine; if (engineType != null) { // TODO jflute lastaflute: [E] fitting: DI :: expression engine property error handling engine = (ExpressionEngine) LdiClassUtil.newInstance(engineType); } else { // mainly here engine = createDefaultEngine(); } return engine; }
protected String filterEnvSwitching(String path) { return LastaDiProperties.getInstance().resolveLastaEnvPath(path); }
public void close() throws SQLException { if (closed) { return; } if (LastaDiProperties.getInstance().isInternalDebug()) { logger.debug("#fw_debug Closed the logical connection: {}", xaConnection); } if (tx == null) { connectionPool.checkIn(this); } else { connectionPool.checkInTx(tx); } }
public String getSmartPackage1() { return getProperty(SMART_PACKAGE1_KEY); }
public String getDiXmlScriptExpressionEngine() { return getProperty(DIXML_SCRIPT_EXPRESSION_ENGINE_KEY); }
public String getSmartPackage3() { return getProperty(SMART_PACKAGE3_KEY); }
public String getPlainPropertyInjectionPackage1() { // e.g. for S2Robot's DBFlute return getProperty(PLAIN_PROPERTY_INJECTION_PACKAGE1_KEY); }