本文整理汇总了Java中ninja.utils.NinjaConstant类的典型用法代码示例。如果您正苦于以下问题:Java NinjaConstant类的具体用法?Java NinjaConstant怎么用?Java NinjaConstant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NinjaConstant类属于ninja.utils包,在下文中一共展示了NinjaConstant类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startServer
import ninja.utils.NinjaConstant; //导入依赖的package包/类
/**
* This method reads the configuration properties from
* your application.conf file and configures jOOQ accordingly.
*
*/
public final void startServer(){
logger.info("Starting jOOQ Module.");
// Setup basic parameters
boolean renderSchema = ninjaProperties.getBooleanWithDefault(JOOQ_RENDER_SCHEMA, true);
//renderMapping
String renderNameStyleString = ninjaProperties.getWithDefault(JOOQ_RENDER_NAME_STYLE, "QUOTED");
RenderNameStyle renderNameStyle = RenderNameStyle.fromValue(renderNameStyleString);
String renderKeywordStyleString = ninjaProperties.getWithDefault(JOOQ_RENDER_KEYWORD_STYLE, "LOWER");
RenderKeywordStyle renderKeywordStyle = RenderKeywordStyle.valueOf(renderKeywordStyleString);
boolean renderFormatted = ninjaProperties.getBooleanWithDefault(JOOQ_RENDER_FORMATTED, false);
String statementTypeString = ninjaProperties.getWithDefault(JOOQ_STATEMENT_TYPE, "PREPARED_STATEMENT");
StatementType statementType = StatementType.valueOf(statementTypeString);
boolean executeLogging = ninjaProperties.getBooleanWithDefault(JOOQ_EXECUTE_LOGGING, true);
// Execute listeners
boolean executeWithOptimisticLocking = ninjaProperties
.getBooleanWithDefault(JOOQ_EXECUTE_WITH_OPTIMISTIC_LOCKING, true);
boolean attachRecords = ninjaProperties.getBooleanWithDefault(JOOQ_ATTACH_RECORDS, true);
String sqlDialectString = ninjaProperties.getWithDefault(JOOQ_SQL_DIALECT, "DEFAULT");
SQLDialect sqlDialect = SQLDialect.valueOf(sqlDialectString);
Settings settings = new Settings();
settings.setRenderSchema(renderSchema);
settings.setRenderNameStyle(renderNameStyle);
settings.setRenderKeywordStyle(renderKeywordStyle);
settings.setRenderFormatted(renderFormatted);
settings.setStatementType(statementType);
settings.setExecuteLogging(executeLogging);
settings.setExecuteWithOptimisticLocking(executeWithOptimisticLocking);
settings.setAttachRecords(attachRecords);
String connectionUrl = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_URL);
String connectionUsername = ninjaProperties.getOrDie(NinjaConstant.DB_CONNECTION_USERNAME);
String connectionPassword = ninjaProperties.getWithDefault(NinjaConstant.DB_CONNECTION_PASSWORD, "");
BasicDataSource connectionPool = new BasicDataSource();
connectionPool.setUrl(connectionUrl);
connectionPool.setUsername(connectionUsername);
connectionPool.setPassword(connectionPassword);
Configuration configuration = new DefaultConfiguration();
configuration.set(sqlDialect);
configuration.set(settings);
configuration.set(connectionPool);
dslContext = DSL.using(configuration);
}
示例2: filter
import ninja.utils.NinjaConstant; //导入依赖的package包/类
@Override
public Result filter(FilterChain chain, Context context) {
Session session = context.getSession();
if (session != null) {
String username = session.get(USERNAME);
if (username != null) {
if (dao.isAdmin(username)) {
return chain.next(context);
}
}
}
return Results.forbidden().html()
.template(NinjaConstant.LOCATION_VIEW_FTL_HTML_FORBIDDEN);
}
示例3: startServerInTestMode
import ninja.utils.NinjaConstant; //导入依赖的package包/类
@Before
public void startServerInTestMode() {
System.setProperty(NinjaConstant.MODE_KEY_NAME, NinjaConstant.MODE_TEST);
ninjaTestServer = new NinjaTestServer();
ninjaTestBrowser = new TestBrowserImpl();
}
示例4: shutdownServer
import ninja.utils.NinjaConstant; //导入依赖的package包/类
@After
public void shutdownServer() {
System.clearProperty(NinjaConstant.MODE_KEY_NAME);
ninjaTestServer.shutdown();
}
示例5: startServerInTestMode
import ninja.utils.NinjaConstant; //导入依赖的package包/类
@Before
public void startServerInTestMode() {
System.setProperty(NinjaConstant.MODE_KEY_NAME, NinjaConstant.MODE_TEST);
ninjaTestServer = new NinjaTestServer();
}