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
}
}
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;
}
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;
}
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);
}
}
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;
}
Aggregations