Search in sources :

Example 1 with XMLConfigAdmin

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

the class DataSourceServiceImpl method removeDatasource.

@Override
public void removeDatasource(String name) throws SQLException, SecurityException {
    checkWriteAccess();
    try {
        XMLConfigAdmin admin = XMLConfigAdmin.newInstance(config(), null);
        admin.removeDataSource(name);
    } catch (Exception e) {
    // ignoriert wenn die db nicht existiert
    }
}
Also used : XMLConfigAdmin(lucee.runtime.config.XMLConfigAdmin) ServiceException(coldfusion.server.ServiceException) IOException(java.io.IOException) SecurityException(lucee.runtime.exp.SecurityException) ExpressionException(lucee.runtime.exp.ExpressionException) SQLException(java.sql.SQLException) PageRuntimeException(lucee.runtime.exp.PageRuntimeException) PageException(lucee.runtime.exp.PageException)

Example 2 with XMLConfigAdmin

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

the class CacheRegionNew method _call.

static String _call(PageContext pc, String cacheName, Struct properties, Boolean throwOnError, String strWebAdminPassword) throws PageException {
    Password webAdminPassword = CacheUtil.getPassword(pc, strWebAdminPassword, false);
    try {
        // TODO why we have here EHCache?
        XMLConfigAdmin adminConfig = XMLConfigAdmin.newInstance((ConfigWebImpl) pc.getConfig(), webAdminPassword);
        adminConfig.updateCacheConnection(cacheName, new ClassDefinitionImpl("org.lucee.extension.cache.eh.EHCache", null, null, pc.getConfig().getIdentification()), Config.CACHE_TYPE_NONE, properties, false, false);
        adminConfig.storeAndReload();
    } catch (Exception e) {
        if (throwOnError)
            throw Caster.toPageException(e);
    }
    return null;
}
Also used : ClassDefinitionImpl(lucee.transformer.library.ClassDefinitionImpl) XMLConfigAdmin(lucee.runtime.config.XMLConfigAdmin) FunctionException(lucee.runtime.exp.FunctionException) PageException(lucee.runtime.exp.PageException) Password(lucee.runtime.config.Password)

Example 3 with XMLConfigAdmin

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

the class RestDeleteApplication method call.

public static String call(PageContext pc, String dirPath, String strWebAdminPassword) throws PageException {
    Password webAdminPassword = CacheUtil.getPassword(pc, strWebAdminPassword, false);
    Resource dir = RestDeleteApplication.toResource(pc, dirPath);
    ConfigWebImpl config = (ConfigWebImpl) pc.getConfig();
    try {
        XMLConfigAdmin admin = XMLConfigAdmin.newInstance((ConfigWebImpl) pc.getConfig(), webAdminPassword);
        Mapping[] mappings = config.getRestMappings();
        Mapping mapping;
        for (int i = 0; i < mappings.length; i++) {
            mapping = mappings[i];
            if (RestUtil.isMatch(pc, mapping, dir)) {
                admin.removeRestMapping(mapping.getVirtual());
                admin.storeAndReload();
            }
        }
    } catch (Exception e) {
        throw Caster.toPageException(e);
    }
    return null;
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) Resource(lucee.commons.io.res.Resource) Mapping(lucee.runtime.rest.Mapping) XMLConfigAdmin(lucee.runtime.config.XMLConfigAdmin) FunctionException(lucee.runtime.exp.FunctionException) PageException(lucee.runtime.exp.PageException) Password(lucee.runtime.config.Password)

Example 4 with XMLConfigAdmin

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

the class RestInitApplication method update.

private static void update(PageContext pc, Resource dir, String virtual, Password webAdminPassword, boolean defaultMapping) throws PageException {
    try {
        XMLConfigAdmin admin = XMLConfigAdmin.newInstance((ConfigWebImpl) pc.getConfig(), webAdminPassword);
        admin.updateRestMapping(virtual, dir.getAbsolutePath(), defaultMapping);
        admin.storeAndReload();
    } catch (Exception e) {
        throw Caster.toPageException(e);
    }
}
Also used : XMLConfigAdmin(lucee.runtime.config.XMLConfigAdmin) PageException(lucee.runtime.exp.PageException)

Example 5 with XMLConfigAdmin

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

the class CacheRegionRemove method _call.

static String _call(PageContext pc, String cacheName, String strWebAdminPassword) throws PageException {
    Password webAdminPassword = CacheUtil.getPassword(pc, strWebAdminPassword, false);
    try {
        XMLConfigAdmin adminConfig = XMLConfigAdmin.newInstance((ConfigWebImpl) pc.getConfig(), webAdminPassword);
        adminConfig.removeCacheConnection(cacheName);
        adminConfig.storeAndReload();
    } catch (Exception e) {
        throw Caster.toPageException(e);
    }
    return null;
}
Also used : XMLConfigAdmin(lucee.runtime.config.XMLConfigAdmin) FunctionException(lucee.runtime.exp.FunctionException) PageException(lucee.runtime.exp.PageException) Password(lucee.runtime.config.Password)

Aggregations

XMLConfigAdmin (lucee.runtime.config.XMLConfigAdmin)5 PageException (lucee.runtime.exp.PageException)5 Password (lucee.runtime.config.Password)3 FunctionException (lucee.runtime.exp.FunctionException)3 ServiceException (coldfusion.server.ServiceException)1 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1 Resource (lucee.commons.io.res.Resource)1 ConfigWebImpl (lucee.runtime.config.ConfigWebImpl)1 ExpressionException (lucee.runtime.exp.ExpressionException)1 PageRuntimeException (lucee.runtime.exp.PageRuntimeException)1 SecurityException (lucee.runtime.exp.SecurityException)1 Mapping (lucee.runtime.rest.Mapping)1 ClassDefinitionImpl (lucee.transformer.library.ClassDefinitionImpl)1