當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。