Search in sources :

Example 1 with ServiceException

use of coldfusion.server.ServiceException in project Lucee by lucee.

the class DataSourceServiceImpl method getDrivers.

@Override
public Struct getDrivers() throws ServiceException, SecurityException {
    checkReadAccess();
    Struct rtn = new StructImpl();
    Struct driver;
    try {
        Resource luceeContext = ResourceUtil.toResourceExisting(pc(), "/lucee/admin/dbdriver/");
        Resource[] children = luceeContext.listResources(new ExtensionResourceFilter(Constants.getComponentExtensions()));
        String name;
        for (int i = 0; i < children.length; i++) {
            driver = new StructImpl();
            name = ListFirst.call(pc(), children[i].getName(), ".");
            driver.setEL(KeyConstants._name, name);
            driver.setEL("handler", children[i].getName());
            rtn.setEL(name, driver);
        }
    } catch (ExpressionException e) {
        throw new ServiceException(e.getMessage());
    }
    return rtn;
}
Also used : StructImpl(lucee.runtime.type.StructImpl) ServiceException(coldfusion.server.ServiceException) Resource(lucee.commons.io.res.Resource) ExtensionResourceFilter(lucee.commons.io.res.filter.ExtensionResourceFilter) ExpressionException(lucee.runtime.exp.ExpressionException) Struct(lucee.runtime.type.Struct)

Aggregations

ServiceException (coldfusion.server.ServiceException)1 Resource (lucee.commons.io.res.Resource)1 ExtensionResourceFilter (lucee.commons.io.res.filter.ExtensionResourceFilter)1 ExpressionException (lucee.runtime.exp.ExpressionException)1 Struct (lucee.runtime.type.Struct)1 StructImpl (lucee.runtime.type.StructImpl)1