Search in sources :

Example 6 with RefBoolean

use of lucee.commons.lang.types.RefBoolean in project Lucee by lucee.

the class MixedAppListener method onRequest.

@Override
public void onRequest(PageContext pc, PageSource requestedPage, RequestListener rl) throws PageException {
    RefBoolean isCFC = new RefBooleanImpl(false);
    PageSource appPS = getApplicationPageSource(pc, requestedPage, mode, isCFC);
    if (isCFC.toBooleanValue())
        _onRequest(pc, requestedPage, appPS, rl);
    else
        ClassicAppListener._onRequest(pc, requestedPage, appPS, rl);
}
Also used : RefBoolean(lucee.commons.lang.types.RefBoolean) RefBooleanImpl(lucee.commons.lang.types.RefBooleanImpl) PageSource(lucee.runtime.PageSource)

Example 7 with RefBoolean

use of lucee.commons.lang.types.RefBoolean in project Lucee by lucee.

the class ModernAppListener method initApplicationContext.

private ModernApplicationContext initApplicationContext(PageContextImpl pc, Component app) throws PageException {
    // use existing app context
    RefBoolean throwsErrorWhileInit = new RefBooleanImpl(false);
    ModernApplicationContext appContext = new ModernApplicationContext(pc, app, throwsErrorWhileInit);
    pc.setApplicationContext(appContext);
    // scope cascading
    if (pc.getRequestDialect() == CFMLEngine.DIALECT_CFML && ((UndefinedImpl) pc.undefinedScope()).getScopeCascadingType() != appContext.getScopeCascading()) {
        pc.undefinedScope().initialize(pc);
    }
    // ORM
    if (appContext.isORMEnabled()) {
        boolean hasError = throwsErrorWhileInit.toBooleanValue();
        if (hasError)
            pc.addPageSource(app.getPageSource(), true);
        try {
            ORMUtil.resetEngine(pc, false);
        } finally {
            if (hasError)
                pc.removeLastPageSource(true);
        }
    }
    return appContext;
}
Also used : UndefinedImpl(lucee.runtime.type.scope.UndefinedImpl) RefBoolean(lucee.commons.lang.types.RefBoolean) RefBooleanImpl(lucee.commons.lang.types.RefBooleanImpl)

Example 8 with RefBoolean

use of lucee.commons.lang.types.RefBoolean in project Lucee by lucee.

the class DumpStruct method call.

public static Struct call(PageContext pc, Object object, double maxLevel, String show, String hide, double keys, boolean metainfo, boolean showUDFs, String label) {
    if (show != null && "all".equalsIgnoreCase(show.trim()))
        show = null;
    if (hide != null && "all".equalsIgnoreCase(hide.trim()))
        hide = null;
    Set<String> setShow = (show != null) ? ListUtil.listToSet(show.toLowerCase(), ",", true) : null;
    Set<String> setHide = (hide != null) ? ListUtil.listToSet(hide.toLowerCase(), ",", true) : null;
    DumpProperties properties = new DumpProperties((int) maxLevel, setShow, setHide, (int) keys, metainfo, showUDFs);
    DumpData dd = DumpUtil.toDumpData(object, pc, (int) maxLevel, properties);
    if (!StringUtil.isEmpty(label)) {
        DumpTable table = new DumpTable("#ffffff", "#cccccc", "#000000");
        table.appendRow(1, new SimpleDumpData(label));
        table.appendRow(0, dd);
        dd = table;
    }
    RefBoolean hasReference = new RefBooleanImpl(false);
    Struct sct = toStruct(dd, object, hasReference);
    sct.setEL("hasReference", hasReference.toBoolean());
    addMetaData(sct, object);
    return sct;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) RefBoolean(lucee.commons.lang.types.RefBoolean) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) DumpProperties(lucee.runtime.dump.DumpProperties) RefBooleanImpl(lucee.commons.lang.types.RefBooleanImpl) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) DumpData(lucee.runtime.dump.DumpData) Struct(lucee.runtime.type.Struct)

Example 9 with RefBoolean

use of lucee.commons.lang.types.RefBoolean in project Lucee by lucee.

the class ScopeContext method invalidateUserScope.

public void invalidateUserScope(PageContextImpl pc, boolean migrateSessionData, boolean migrateClientData) throws PageException {
    ApplicationContext appContext = pc.getApplicationContext();
    RefBoolean isNew = new RefBooleanImpl();
    // get in memory scopes
    Map<String, Scope> clientContext = getSubMap(cfClientContexts, appContext.getName());
    UserScope oldClient = (UserScope) clientContext.get(pc.getCFID());
    Map<String, Scope> sessionContext = getSubMap(cfSessionContexts, appContext.getName());
    UserScope oldSession = (UserScope) sessionContext.get(pc.getCFID());
    // remove Scopes completly
    removeCFSessionScope(pc);
    removeClientScope(pc);
    pc.resetIdAndToken();
    if (oldSession != null)
        migrate(pc, oldSession, getCFSessionScope(pc, isNew), migrateSessionData);
    if (oldClient != null)
        migrate(pc, oldClient, getClientScope(pc), migrateClientData);
}
Also used : ApplicationContext(lucee.runtime.listener.ApplicationContext) RefBoolean(lucee.commons.lang.types.RefBoolean) StorageScope(lucee.runtime.type.scope.storage.StorageScope) MemoryScope(lucee.runtime.type.scope.storage.MemoryScope) RefBooleanImpl(lucee.commons.lang.types.RefBooleanImpl)

Example 10 with RefBoolean

use of lucee.commons.lang.types.RefBoolean in project Lucee by lucee.

the class SelectParser method column.

private Expression column(ParserString raw) throws SQLParserException {
    RefBoolean hb = new RefBooleanImpl(false);
    String name = identifier(raw, hb);
    if (name == null)
        return null;
    if (!hb.toBooleanValue()) {
        if ("true".equalsIgnoreCase(name))
            return ValueBoolean.TRUE;
        if ("false".equalsIgnoreCase(name))
            return ValueBoolean.FALSE;
        if ("null".equalsIgnoreCase(name))
            return ValueNull.NULL;
    }
    ColumnExpression column = new ColumnExpression(name, name.equals("?") ? columnIndex++ : 0);
    raw.removeSpace();
    while (raw.forwardIfCurrent(".")) {
        raw.removeSpace();
        String sub = identifier(raw, hb);
        if (sub == null)
            throw new SQLParserException("invalid column definition");
        column.setSub(sub);
    }
    raw.removeSpace();
    if (raw.forwardIfCurrent('(')) {
        return new OperationN(column.getFullName(), readArguments(raw));
    }
    return column;
}
Also used : RefBoolean(lucee.commons.lang.types.RefBoolean) ColumnExpression(lucee.runtime.sql.exp.ColumnExpression) OperationN(lucee.runtime.sql.exp.op.OperationN) ParserString(lucee.commons.lang.ParserString) ValueString(lucee.runtime.sql.exp.value.ValueString) RefBooleanImpl(lucee.commons.lang.types.RefBooleanImpl)

Aggregations

RefBoolean (lucee.commons.lang.types.RefBoolean)16 RefBooleanImpl (lucee.commons.lang.types.RefBooleanImpl)16 IOException (java.io.IOException)3 ParserString (lucee.commons.lang.ParserString)3 PageException (lucee.runtime.exp.PageException)3 ColumnExpression (lucee.runtime.sql.exp.ColumnExpression)3 ValueString (lucee.runtime.sql.exp.value.ValueString)3 Entry (java.util.Map.Entry)2 Resource (lucee.commons.io.res.Resource)2 Component (lucee.runtime.Component)2 PageSource (lucee.runtime.PageSource)2 ApplicationException (lucee.runtime.exp.ApplicationException)2 PageRuntimeException (lucee.runtime.exp.PageRuntimeException)2 TemplateException (lucee.runtime.exp.TemplateException)2 Expression (lucee.runtime.sql.exp.Expression)2 Attribute (lucee.transformer.bytecode.statement.tag.Attribute)2 Expression (lucee.transformer.expression.Expression)2 LitString (lucee.transformer.expression.literal.LitString)2 TagLibTagAttr (lucee.transformer.library.tag.TagLibTagAttr)2 Instrumentation (java.lang.instrument.Instrumentation)1