Search in sources :

Example 16 with ConfigWebImpl

use of lucee.runtime.config.ConfigWebImpl in project Lucee by lucee.

the class GetSystemInfo method call.

public static Struct call(PageContext pc) throws PageException {
    Struct sct = new StructImpl();
    ConfigWebImpl config = (ConfigWebImpl) pc.getConfig();
    CFMLFactoryImpl factory = (CFMLFactoryImpl) config.getFactory();
    ScopeContext sc = factory.getScopeContext();
    // OperatingSystemMXBean osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
    // threads/requests
    sct.put("activeRequests", factory.getActiveRequests());
    sct.put("activeThreads", factory.getActiveThreads());
    sct.put("queueRequests", config.getThreadQueue().size());
    // Datasource connections
    sct.put("activeDatasourceConnections", getConnections(config));
    // tasks
    sct.put("tasksOpen", config.getSpoolerEngine().getOpenTaskCount());
    sct.put("tasksClosed", config.getSpoolerEngine().getClosedTaskCount());
    // scopes
    sct.put("sessionCount", sc.getSessionCount());
    sct.put("clientCount", sc.getClientCount());
    sct.put("applicationContextCount", sc.getAppContextCount());
    return sct;
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) StructImpl(lucee.runtime.type.StructImpl) ScopeContext(lucee.runtime.type.scope.ScopeContext) CFMLFactoryImpl(lucee.runtime.CFMLFactoryImpl) Struct(lucee.runtime.type.Struct)

Example 17 with ConfigWebImpl

use of lucee.runtime.config.ConfigWebImpl in project Lucee by lucee.

the class PagePoolClear method call.

public static boolean call(PageContext pc) {
    ConfigWebImpl config = (ConfigWebImpl) pc.getConfig();
    clear(config.getMappings());
    clear(config.getCustomTagMappings());
    clear(pc.getApplicationContext().getMappings());
    clear(config.getComponentMappings());
    clear(config.getFunctionMapping());
    clear(config.getServerFunctionMapping());
    clear(config.getTagMapping());
    clear(config.getServerTagMapping());
    return true;
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl)

Example 18 with ConfigWebImpl

use of lucee.runtime.config.ConfigWebImpl in project Lucee by lucee.

the class SystemCacheClear method tagCache.

private static void tagCache(PageContext pc) {
    ConfigWebImpl config = (ConfigWebImpl) pc.getConfig();
    PagePoolClear.clear(config.getServerTagMapping());
    PagePoolClear.clear(config.getTagMapping());
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl)

Example 19 with ConfigWebImpl

use of lucee.runtime.config.ConfigWebImpl in project Lucee by lucee.

the class AppListenerUtil method toMappings.

public static Mapping[] toMappings(ConfigWeb cw, Object o, Resource source) throws PageException {
    Struct sct = Caster.toStruct(o);
    Iterator<Entry<Key, Object>> it = sct.entryIterator();
    Entry<Key, Object> e;
    java.util.List<Mapping> mappings = new ArrayList<Mapping>();
    ConfigWebImpl config = (ConfigWebImpl) cw;
    String virtual;
    while (it.hasNext()) {
        e = it.next();
        virtual = translateMappingVirtual(e.getKey().getString());
        MappingData md = toMappingData(e.getValue(), source);
        mappings.add(config.getApplicationMapping("application", virtual, md.physical, md.archive, md.physicalFirst, false));
    }
    return mappings.toArray(new Mapping[mappings.size()]);
}
Also used : ArrayList(java.util.ArrayList) Mapping(lucee.runtime.Mapping) Struct(lucee.runtime.type.Struct) ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) Entry(java.util.Map.Entry) Key(lucee.runtime.type.Collection.Key)

Example 20 with ConfigWebImpl

use of lucee.runtime.config.ConfigWebImpl in project Lucee by lucee.

the class AppListenerUtil method toMappings.

private static Mapping[] toMappings(ConfigWeb cw, String type, Object o, boolean useStructNames, Resource source) throws PageException {
    ConfigWebImpl config = (ConfigWebImpl) cw;
    Array array;
    if (o instanceof String) {
        array = ListUtil.listToArrayRemoveEmpty(Caster.toString(o), ',');
    } else if (o instanceof Struct) {
        Struct sct = (Struct) o;
        if (useStructNames) {
            Iterator<Entry<Key, Object>> it = sct.entryIterator();
            List<Mapping> list = new ArrayList<Mapping>();
            Entry<Key, Object> e;
            String virtual;
            while (it.hasNext()) {
                e = it.next();
                virtual = e.getKey().getString();
                if (virtual.length() == 0)
                    virtual = "/";
                if (!virtual.startsWith("/"))
                    virtual = "/" + virtual;
                if (!virtual.equals("/") && virtual.endsWith("/"))
                    virtual = virtual.substring(0, virtual.length() - 1);
                MappingData md = toMappingData(e.getValue(), source);
                list.add(config.getApplicationMapping(type, virtual, md.physical, md.archive, md.physicalFirst, true));
            }
            return list.toArray(new Mapping[list.size()]);
        }
        array = new ArrayImpl();
        Iterator<Object> it = sct.valueIterator();
        while (it.hasNext()) {
            array.append(it.next());
        }
    } else {
        array = Caster.toArray(o);
    }
    MappingImpl[] mappings = new MappingImpl[array.size()];
    for (int i = 0; i < mappings.length; i++) {
        MappingData md = toMappingData(array.getE(i + 1), source);
        mappings[i] = (MappingImpl) config.getApplicationMapping(type, "/" + i, md.physical, md.archive, md.physicalFirst, true);
    }
    return mappings;
}
Also used : ArrayImpl(lucee.runtime.type.ArrayImpl) Mapping(lucee.runtime.Mapping) MappingImpl(lucee.runtime.MappingImpl) Struct(lucee.runtime.type.Struct) Array(lucee.runtime.type.Array) ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) Entry(java.util.Map.Entry) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) Key(lucee.runtime.type.Collection.Key)

Aggregations

ConfigWebImpl (lucee.runtime.config.ConfigWebImpl)42 Resource (lucee.commons.io.res.Resource)9 PageContextImpl (lucee.runtime.PageContextImpl)9 Struct (lucee.runtime.type.Struct)9 PageSource (lucee.runtime.PageSource)8 PageException (lucee.runtime.exp.PageException)8 Key (lucee.runtime.type.Collection.Key)8 CFMLFactoryImpl (lucee.runtime.CFMLFactoryImpl)7 Mapping (lucee.runtime.Mapping)7 ConfigServer (lucee.runtime.config.ConfigServer)6 ConfigWeb (lucee.runtime.config.ConfigWeb)5 ApplicationException (lucee.runtime.exp.ApplicationException)5 StructImpl (lucee.runtime.type.StructImpl)5 IOException (java.io.IOException)4 Entry (java.util.Map.Entry)4 ConfigImpl (lucee.runtime.config.ConfigImpl)4 HTTPResource (lucee.commons.io.res.type.http.HTTPResource)3 Page (lucee.runtime.Page)3 PageContext (lucee.runtime.PageContext)3 ExpressionException (lucee.runtime.exp.ExpressionException)3