当前位置: 首页>>代码示例>>Java>>正文


Java NinjaConstant类代码示例

本文整理汇总了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);
}
 
开发者ID:jschaf,项目名称:ninja-jooq,代码行数:63,代码来源:NinjaJooqLifecycle.java

示例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);

}
 
开发者ID:r10r-org,项目名称:doctester,代码行数:24,代码来源:AdminFilter.java

示例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();
}
 
开发者ID:r10r-org,项目名称:doctester,代码行数:7,代码来源:NinjaTest.java

示例4: shutdownServer

import ninja.utils.NinjaConstant; //导入依赖的package包/类
@After
public void shutdownServer() {
	System.clearProperty(NinjaConstant.MODE_KEY_NAME);
    ninjaTestServer.shutdown();
}
 
开发者ID:r10r-org,项目名称:doctester,代码行数:6,代码来源:NinjaTest.java

示例5: startServerInTestMode

import ninja.utils.NinjaConstant; //导入依赖的package包/类
@Before
public void startServerInTestMode() {
    System.setProperty(NinjaConstant.MODE_KEY_NAME, NinjaConstant.MODE_TEST);
    ninjaTestServer = new NinjaTestServer();
}
 
开发者ID:r10r-org,项目名称:doctester,代码行数:6,代码来源:NinjaApiDoctester.java


注:本文中的ninja.utils.NinjaConstant类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。