Search in sources :

Example 31 with ConfigImpl

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

the class DBUtilImpl method releaseDatasourceConnection.

public void releaseDatasourceConnection(Config config, DatasourceConnection dc) {
    ConfigImpl ci = (ConfigWebImpl) ThreadLocalPageContext.getConfig(config);
    ci.getDatasourceConnectionPool().releaseDatasourceConnection(dc);
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) ConfigImpl(lucee.runtime.config.ConfigImpl)

Example 32 with ConfigImpl

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

the class ProfileCollection method init.

private void init(Config config, boolean initProfiles) throws ApplicationException {
    // get the video directory
    Resource dir = ((ConfigImpl) config).getVideoDirectory();
    // get the video.xml
    Resource xml = dir.getRealResource("video.xml");
    // create (if not exist) and return video xml as dom
    Element video;
    try {
        video = getVideoXML(xml);
    } catch (Exception e) {
        throw new ApplicationException("can not load video xml file [" + xml + "]", Caster.toClassName(e) + ":" + e.getMessage());
    }
    // translate form DOM to a List of VideoProfile
    if (initProfiles) {
        try {
            profiles = translateVideoXML(video);
        } catch (PageException e) {
            throw new ApplicationException("can not load profiles from video xml file [" + xml + "] a type is invalid", e.getMessage());
        }
    }
}
Also used : PageException(lucee.runtime.exp.PageException) ApplicationException(lucee.runtime.exp.ApplicationException) Element(org.w3c.dom.Element) Resource(lucee.commons.io.res.Resource) ConfigImpl(lucee.runtime.config.ConfigImpl) IOException(java.io.IOException) ApplicationException(lucee.runtime.exp.ApplicationException) SAXException(org.xml.sax.SAXException) PageException(lucee.runtime.exp.PageException)

Example 33 with ConfigImpl

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

the class StorageScopeDatasource method store.

@Override
public void store(PageContext pc) {
    DatasourceConnection dc = null;
    ConfigImpl ci = (ConfigImpl) ThreadLocalPageContext.getConfig(pc);
    DatasourceConnectionPool pool = ci.getDatasourceConnectionPool();
    Log log = ci.getLog("scope");
    try {
        // FUTURE change method interface
        pc = ThreadLocalPageContext.get(pc);
        DataSource ds;
        if (pc != null)
            ds = pc.getDataSource(datasourceName);
        else
            ds = ci.getDataSource(datasourceName);
        dc = pool.getDatasourceConnection(null, ds, null, null);
        SQLExecutor executor = SQLExecutionFactory.getInstance(dc);
        executor.update(ci, cfid, appName, dc, getType(), sct, getTimeSpan(), log);
    } catch (Throwable t) {
        ExceptionUtil.rethrowIfNecessary(t);
        ScopeContext.error(log, t);
    } finally {
        if (dc != null)
            pool.releaseDatasourceConnection(dc);
    }
}
Also used : DatasourceConnection(lucee.runtime.db.DatasourceConnection) DatasourceConnectionPool(lucee.runtime.db.DatasourceConnectionPool) Log(lucee.commons.io.log.Log) SQLExecutor(lucee.runtime.type.scope.storage.db.SQLExecutor) ConfigImpl(lucee.runtime.config.ConfigImpl) DataSource(lucee.runtime.db.DataSource)

Example 34 with ConfigImpl

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

the class StorageScopeFile method _loadResource.

protected static Resource _loadResource(ConfigWeb config, int type, String name, String cfid) {
    ConfigImpl ci = (ConfigImpl) config;
    Resource dir = type == SCOPE_CLIENT ? ci.getClientScopeDir() : ci.getSessionScopeDir();
    return dir.getRealResource(getFolderName(name, cfid, true));
}
Also used : Resource(lucee.commons.io.res.Resource) ConfigImpl(lucee.runtime.config.ConfigImpl)

Example 35 with ConfigImpl

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

the class ORMUtil method resetEngine.

/**
 * @param pc
 * @param force if set to false the engine is on loaded when the configuration has changed
 * @throws PageException
 */
public static void resetEngine(PageContext pc, boolean force) throws PageException {
    ConfigImpl config = (ConfigImpl) pc.getConfig();
    config.resetORMEngine(pc, force);
}
Also used : ConfigImpl(lucee.runtime.config.ConfigImpl)

Aggregations

ConfigImpl (lucee.runtime.config.ConfigImpl)47 PageException (lucee.runtime.exp.PageException)15 Log (lucee.commons.io.log.Log)14 DatasourceConnection (lucee.runtime.db.DatasourceConnection)10 ApplicationException (lucee.runtime.exp.ApplicationException)8 Struct (lucee.runtime.type.Struct)8 StructImpl (lucee.runtime.type.StructImpl)8 DataSource (lucee.runtime.db.DataSource)7 DatasourceConnectionPool (lucee.runtime.db.DatasourceConnectionPool)7 SQLExecutor (lucee.runtime.type.scope.storage.db.SQLExecutor)7 SQLException (java.sql.SQLException)6 Resource (lucee.commons.io.res.Resource)6 PageContextImpl (lucee.runtime.PageContextImpl)6 PageSource (lucee.runtime.PageSource)6 QueryImpl (lucee.runtime.type.QueryImpl)5 ArrayList (java.util.ArrayList)4 ConfigWebImpl (lucee.runtime.config.ConfigWebImpl)4 DatabaseException (lucee.runtime.exp.DatabaseException)4 Key (lucee.runtime.type.Collection.Key)4 IOException (java.io.IOException)3