/** * Returns the property value as {@link Boolean} type. */ default boolean getBooleanProperty(String name) { return getBooleanProperty(name, false); }
@Override public void postCreate(BeanFactory factory) throws Throwable { ormModelsConfigs = config.getExtension(OrmModelsConfigs.class); }
public static Map<String, Object> extractMap(AppConfig config) { Map<String, Object> map = new LinkedHashMap<>(); config.getPropertyNames().forEach(key -> { String value = config.getProperty(key); extractMap(map, key, value); }); return map; }
void load(AppConfig config) { this.config = config; this.basePackage = config.getBasePackage() + "."; Boolean redefineProp = config.getProperty("instrument.redefine", Boolean.class); if(null == redefineProp) { redefine = testing; }else{ redefine = redefineProp; } instrumentation.init(config); loadAllClasses(); }
@Override public boolean isDebug() { if(null == debug){ debug = getAppContext().getConfig().isDebug(); } return debug; }
/** * Returns the property value as {@link Long} type. */ default long getLongProperty(String name, long defaultValue) { return getProperty(name, Long.class, defaultValue); }
if(not == Strings.equalsIgnoreCase(config.getProfile(), profile)) { return not; if(not == Converts.toBoolean(config.getProperty(property))){ return not;
public void configure() { if(!endpoints.isEmpty()) { endpoints.forEach(r -> app.routes().remove(r)); } Map<String, Object> map = ConfigUtils.extractMap(app.config(), CONF_PREFIX); if(null == map || map.isEmpty()) { return; } config = Converts.convert(map, OAuth2ServerConfig.class); if(!config.isEnabled()) { return; } //clients config.getClients().forEach((id, c) -> { c.setId(id); validator.validate(CONF_PREFIX + ".clients." + id, c); }); //url int port = app.config().getIntProperty("server.port", 8080); String contextPath = app.config().getProperty("server.context-path", ""); this.url = (config.isSsl() ? "https:" : "http") + "://localhost:" + port + contextPath; //gen key pair if(null == keyPair) { keyPair = RSA.generateKeyPair(); signer = new RsaSigner(keyPair.getPrivateKey()); verifier = new RsaVerifier(keyPair.getPublicKey()); } //create endpoint createEndpoints(app.routes()); }
String[] array = config.getArrayProperty(key); String[] array = config.getArrayProperty(key); String[] array = config.getArrayProperty(key); String prop = config.getProperty(key);
public BeanContainer(AppConfig config){ this.config = config; this.beanConfigurator = new BeanConfigurator(config); this.placeholderResolver = config.getPlaceholderResolver(); this.annotationBeanDefinitionLoader = new AnnotationBeanDefinitionLoader(); this.xmlBeanDefinitionLoader = new XmlBeanDefinitionLoader(this); }
public void readExternalConfig(ConfigSupport cs, String externalConfig) { File file = new File(externalConfig); if(!file.exists()) { throw new IllegalStateException("External config '" + externalConfig + "' not exists!"); } if(file.isDirectory()) { throw new IllegalStateException("External config '" + externalConfig + "' must be a file!"); } if(!file.canRead()) { throw new IllegalStateException("External config '" + externalConfig + "' can't be read!"); } String profile = ac.getProfile(); FileResource resource = Resources.createFileResource(externalConfig); Map<String,String> props = ConfigUtils.read(ac, profile, resource, null); log.info("Read {} props from external config : {}", props.size(), resource.getDescription()); cs.putProperties(props); }
@Override public void setAppConfig(AppConfig config) { this.defaultLocale = config.getDefaultLocale(); }
this.privateKey = app.config().ensureGetPrivateKey(); this.publicKey = app.config().ensureGetPublicKey();
@Override public PrivateKey ensureGetPrivateKey() { if(null == privateKey) { return appConfig.ensureGetPrivateKey(); } return null; }
/** * Returns the property value as {@link Integer} type. */ default int getIntProperty(String name) { return getIntProperty(name, 0); }
@Override protected void init(AppConfig config) { createEntityMapping(dmo, config.isDebug()); resolveSqlCommands(dao, dao.getOrmContext().getMetadata()); }
/** * Returns the property value as {@link Boolean} type. */ default boolean getBooleanProperty(String name,boolean defaultValue) { return getProperty(name, Boolean.class, defaultValue); }
if(null != profile && !profile.test(Strings.equalsIgnoreCase(config.getProfile(), profile.value))) { return false; if(null != property && !property.test(Converts.toBoolean(config.getProperty(property.value)))) { return false;
protected void loadSqls(SqlReaderContext context, Resource resource, boolean defaultOverride, Map<String,DefaultSqlCommand> sqls) throws IOException{ try(XmlReader reader = XML.createReader(resource) ){ reader.setPlaceholderResolver(context.getConfigContext().getAppContext().getConfig().getPlaceholderResolver()); loadSqls(context, resource, reader, defaultOverride, sqls); } }
protected static boolean matchProfile(BeanContainer container, XmlReader element) { String profile = element.getAttribute(IF_PROFILE); if (!Strings.isEmpty(profile)) { return Strings.equalsIgnoreCase(container.getAppConfig().getProfile(), profile); } else { return true; } }