Search in sources :

Example 31 with ConfigWebImpl

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

the class Admin method _doStartTag.

/**
 * @throws PageException
 */
private void _doStartTag() throws PageException, IOException {
    config = (ConfigImpl) pageContext.getConfig();
    // getToken
    if (action.equals("gettoken")) {
        doGetToken();
        return;
    }
    // schedule
    if (action.equals("schedule")) {
        doTagSchedule();
        return;
    }
    // search
    if (action.equals("collection")) {
        doTagCollection();
        return;
    }
    // index
    if (action.equals("index")) {
        doTagIndex();
        return;
    }
    // cluster
    if (action.equals("setcluster")) {
        doSetCluster();
        return;
    }
    if (action.equals("getcluster")) {
        doGetCluster();
        return;
    }
    if (check("hashpassword", ACCESS_FREE)) {
        String raw = getString("admin", action, "pw");
        Password pw = PasswordImpl.passwordToCompare(pageContext.getConfig(), type != TYPE_WEB, raw);
        Password changed = ((ConfigWebImpl) pageContext.getConfig()).updatePasswordIfNecessary(type == TYPE_SERVER, raw);
        if (changed != null)
            pw = changed;
        pageContext.setVariable(getString("admin", action, "returnVariable"), pw.getPassword());
        // do not remove
        return;
    }
    try {
        // Password
        String strPW = getString("password", "");
        // hash password if
        Password tmp = type == TYPE_SERVER ? ((ConfigWebImpl) config).isServerPasswordEqual(strPW) : config.isPasswordEqual(strPW);
        // compatibility)
        if (tmp != null)
            password = tmp;
        else
            password = null;
        // Config
        if (type == TYPE_SERVER)
            config = (ConfigImpl) pageContext.getConfig().getConfigServer(password);
        adminSync = config.getAdminSync();
        admin = XMLConfigAdmin.newInstance(config, password);
    } catch (Exception e) {
        throw Caster.toPageException(e);
    }
    if (check("connect", ACCESS_FREE)) {
        ConfigWebUtil.checkPassword(config, null, password);
        ConfigWebUtil.checkGeneralReadAccess(config, password);
        try {
            if (config instanceof ConfigServer)
                ((PageContextImpl) pageContext).setServerPassword(password);
        } catch (Throwable t) {
            ExceptionUtil.rethrowIfNecessary(t);
        }
    } else if (check("getinfo", ACCESS_FREE) && check2(ACCESS_READ))
        doGetInfo();
    else if (check("surveillance", ACCESS_FREE) && check2(ACCESS_READ))
        doSurveillance();
    else if (check("getRegional", ACCESS_FREE) && check2(ACCESS_READ))
        doGetRegional();
    else if (check("isMonitorEnabled", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_READ))
        doIsMonitorEnabled();
    else if (check("resetORMSetting", ACCESS_FREE) && check2(ACCESS_READ))
        doResetORMSetting();
    else if (check("getORMSetting", ACCESS_FREE) && check2(ACCESS_READ))
        doGetORMSetting();
    else if (check("getORMEngine", ACCESS_FREE) && check2(ACCESS_READ))
        doGetORMEngine();
    else if (check("updateORMSetting", ACCESS_FREE) && check2(ACCESS_READ))
        doUpdateORMSetting();
    else if (check("getApplicationListener", ACCESS_FREE) && check2(ACCESS_READ))
        doGetApplicationListener();
    else if (check("getProxy", ACCESS_FREE) && check2(ACCESS_READ))
        doGetProxy();
    else if (check("getCharset", ACCESS_FREE) && check2(ACCESS_READ))
        doGetCharset();
    else if (check("getComponent", ACCESS_FREE) && check2(ACCESS_READ))
        doGetComponent();
    else if (check("getScope", ACCESS_FREE) && check2(ACCESS_READ))
        doGetScope();
    else if (check("getApplicationSetting", ACCESS_FREE) && check2(ACCESS_READ))
        doGetApplicationSetting();
    else if (check("getQueueSetting", ACCESS_FREE) && check2(ACCESS_READ))
        doGetQueueSetting();
    else if (check("getOutputSetting", ACCESS_FREE) && check2(ACCESS_READ))
        doGetOutputSetting();
    else if (check("getDatasourceSetting", ACCESS_FREE) && check2(ACCESS_READ))
        doGetDatasourceSetting();
    else if (check("getCustomTagSetting", ACCESS_FREE) && check2(ACCESS_READ))
        doGetCustomTagSetting();
    else if (check("getDatasource", ACCESS_FREE) && check2(ACCESS_READ))
        doGetDatasource();
    else if (check("getDatasources", ACCESS_FREE) && check2(ACCESS_READ))
        doGetDatasources();
    else if (check("getJDBCDrivers", ACCESS_FREE) && check2(ACCESS_READ))
        doGetJDBCDrivers();
    else if (check("getCacheConnections", ACCESS_FREE) && check2(ACCESS_READ))
        doGetCacheConnections();
    else if (check("getCacheConnection", ACCESS_FREE) && check2(ACCESS_READ))
        doGetCacheConnection();
    else if (check("getCacheDefaultConnection", ACCESS_FREE) && check2(ACCESS_READ))
        doGetCacheDefaultConnection();
    else if (check("getRemoteClients", ACCESS_FREE) && check2(ACCESS_READ))
        doGetRemoteClients();
    else if (check("getRemoteClient", ACCESS_FREE) && check2(ACCESS_READ))
        doGetRemoteClient();
    else if (check("hasRemoteClientUsage", ACCESS_FREE) && check2(ACCESS_READ))
        doHasRemoteClientUsage();
    else if (check("getRemoteClientUsage", ACCESS_FREE) && check2(ACCESS_READ))
        doGetRemoteClientUsage();
    else if (check("getSpoolerTasks", ACCESS_FREE) && check2(ACCESS_READ))
        doGetSpoolerTasks();
    else if (check("getPerformanceSettings", ACCESS_FREE) && check2(ACCESS_READ))
        doGetPerformanceSettings();
    else if (check("getLogSettings", ACCESS_FREE) && check2(ACCESS_READ))
        doGetLogSettings();
    else if (check("getCompilerSettings", ACCESS_FREE) && check2(ACCESS_READ))
        doGetCompilerSettings();
    else if (check("updatePerformanceSettings", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdatePerformanceSettings();
    else if (check("updateCompilerSettings", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateCompilerSettings();
    else if (check("getGatewayentries", ACCESS_NOT_WHEN_SERVER) && check2(ACCESS_READ))
        doGetGatewayEntries();
    else if (check("getGatewayentry", ACCESS_NOT_WHEN_SERVER) && check2(ACCESS_READ))
        doGetGatewayEntry();
    else if (check("getRunningThreads", ACCESS_FREE) && check2(ACCESS_READ))
        doGetRunningThreads();
    else if (check("getMonitors", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_READ))
        doGetMonitors();
    else if (check("getMonitor", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_READ))
        doGetMonitor();
    else if (check("getBundles", ACCESS_FREE) && check2(ACCESS_READ))
        doGetBundles();
    else if (check("getBundle", ACCESS_FREE) && check2(ACCESS_READ))
        doGetBundle();
    else if (check("getExecutionLog", ACCESS_FREE) && check2(ACCESS_READ))
        doGetExecutionLog();
    else if (check("gateway", ACCESS_NOT_WHEN_SERVER) && check2(ACCESS_READ))
        doGateway();
    else // alias for getSpoolerTasks
    if (check("getRemoteClientTasks", ACCESS_FREE) && check2(ACCESS_READ))
        doGetSpoolerTasks();
    else if (check("getDatasourceDriverList", ACCESS_FREE) && check2(ACCESS_READ))
        doGetDatasourceDriverList();
    else if (check("getDebuggingList", ACCESS_FREE) && check2(ACCESS_READ))
        doGetDebuggingList();
    else if (check("getLoggedDebugData", ACCESS_FREE) && check2(ACCESS_READ))
        doGetLoggedDebugData();
    else if (check("getDebugSetting", ACCESS_FREE) && check2(ACCESS_READ))
        doGetDebugSetting();
    else if (check("getSSLCertificate", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_READ))
        doGetSSLCertificate();
    else if (check("getPluginDirectory", ACCESS_FREE) && check2(ACCESS_READ))
        doGetPluginDirectory();
    else if (check("getPlugins", ACCESS_FREE) && check2(ACCESS_READ))
        doGetPlugins();
    else if (check("updatePlugin", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdatePlugin();
    else if (check("removePlugin", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemovePlugin();
    else if (check("getContextDirectory", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_READ))
        getContextDirectory();
    else if (check("updateContext", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doUpdateContext();
    else if (check("removeContext", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doRemoveContext();
    else if (check("getJars", ACCESS_FREE) && check2(ACCESS_READ))
        doGetJars();
    else if (check("getFlds", ACCESS_FREE) && check2(ACCESS_READ))
        doGetFLDs();
    else if (check("getTlds", ACCESS_FREE) && check2(ACCESS_READ))
        doGetTLDs();
    else if (check("getRHExtensions", ACCESS_FREE) && check2(ACCESS_READ))
        doGetRHExtensions();
    else if (check("getRHServerExtensions", ACCESS_NOT_WHEN_SERVER) && check2(ACCESS_READ))
        doGetRHServerExtensions();
    else if (check("getLocalExtension", ACCESS_FREE) && check2(ACCESS_READ))
        doGetLocalExtension();
    else if (check("getLocalExtensions", ACCESS_FREE) && check2(ACCESS_READ))
        doGetLocalExtensions();
    else if (check("getMailSetting", ACCESS_FREE) && check2(ACCESS_READ))
        doGetMailSetting();
    else if (check("getTaskSetting", ACCESS_FREE) && check2(ACCESS_READ))
        doGetTaskSetting();
    else if (check("getMailServers", ACCESS_FREE) && check2(ACCESS_READ))
        doGetMailServers();
    else if (check("getMapping", ACCESS_FREE) && check2(ACCESS_READ))
        doGetMapping();
    else if (check("getMappings", ACCESS_FREE) && check2(ACCESS_READ))
        doGetMappings();
    else if (check("getRestMappings", ACCESS_FREE) && check2(ACCESS_READ))
        doGetRestMappings();
    else if (check("getRestSettings", ACCESS_FREE) && check2(ACCESS_READ))
        doGetRestSettings();
    else if (check("getExtensions", ACCESS_FREE) && check2(ACCESS_READ))
        doGetExtensions();
    else if (check("getExtensionProviders", ACCESS_FREE) && check2(ACCESS_READ))
        doGetExtensionProviders();
    else if (check("getRHExtensionProviders", ACCESS_FREE) && check2(ACCESS_READ))
        doGetRHExtensionProviders();
    else if (check("getExtensionInfo", ACCESS_FREE) && check2(ACCESS_READ))
        doGetExtensionInfo();
    else if (check("getCustomTagMappings", ACCESS_FREE) && check2(ACCESS_READ))
        doGetCustomTagMappings();
    else if (check("getComponentMappings", ACCESS_FREE) && check2(ACCESS_READ))
        doGetComponentMappings();
    else if (check("getCfxTags", ACCESS_FREE) && check2(ACCESS_READ))
        doGetCFXTags();
    else if (check("getCPPCfxTags", ACCESS_FREE) && check2(ACCESS_READ))
        doGetCPPCFXTags();
    else if (check("getJavaCfxTags", ACCESS_FREE) && check2(ACCESS_READ))
        doGetJavaCFXTags();
    else if (check("getDebug", ACCESS_FREE) && check2(ACCESS_READ))
        doGetDebug();
    else if (check("getDebugEntry", ACCESS_FREE) && check2(ACCESS_READ))
        doGetDebugEntry();
    else if (check("getError", ACCESS_FREE) && check2(ACCESS_READ))
        doGetError();
    else if (check("verifyremoteclient", ACCESS_FREE) && check2(ACCESS_READ))
        doVerifyRemoteClient();
    else if (check("verifyDatasource", ACCESS_FREE) && check2(ACCESS_READ))
        doVerifyDatasource();
    else if (check("verifyCacheConnection", ACCESS_FREE) && check2(ACCESS_READ))
        doVerifyCacheConnection();
    else if (check("verifyMailServer", ACCESS_FREE) && check2(ACCESS_READ))
        doVerifyMailServer();
    else if (check("verifyExtensionProvider", ACCESS_FREE) && check2(ACCESS_READ))
        doVerifyExtensionProvider();
    else if (check("verifyJavaCFX", ACCESS_FREE) && check2(ACCESS_READ))
        doVerifyJavaCFX();
    else if (check("verifyCFX", ACCESS_FREE) && check2(ACCESS_READ))
        doVerifyCFX();
    else if (check("resetId", ACCESS_FREE) && check2(ACCESS_WRITE))
        doResetId();
    else if (check("updateLoginSettings", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doUpdateLoginSettings();
    else if (check("updateLogSettings", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateLogSettings();
    else if (check("updateJar", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateJar();
    else if (check("updateSSLCertificate", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doUpdateSSLCertificate();
    else if (check("updateMonitorEnabled", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doUpdateMonitorEnabled();
    else if (check("updateTLD", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateTLD();
    else if (check("updateFLD", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateFLD();
    else if (check("updateregional", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateRegional();
    else if (check("updateApplicationListener", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateApplicationListener();
    else if (check("updateCachedWithin", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateCachedWithin();
    else if (check("updateproxy", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateProxy();
    else if (check("updateCharset", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateCharset();
    else if (check("updatecomponent", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateComponent();
    else if (check("updatescope", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateScope();
    else if (check("updateRestSettings", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateRestSettings();
    else if (check("updateRestMapping", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateRestMapping();
    else if (check("removeRestMapping", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveRestMapping();
    else if (check("updateApplicationSetting", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateApplicationSettings();
    else if (check("updateOutputSetting", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateOutputSettings();
    else if (check("updateQueueSetting", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doUpdateQueueSettings();
    else if (check("updatepsq", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdatePSQ();
    else if (check("updatedatasource", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateDatasource();
    else if (check("updateJDBCDriver", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateJDBCDriver();
    else if (check("updateCacheDefaultConnection", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateCacheDefaultConnection();
    else if (check("updateCacheConnection", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateCacheConnection();
    else if (check("updateremoteclient", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateRemoteClient();
    else if (check("updateRemoteClientUsage", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateRemoteClientUsage();
    else if (check("updatemailsetting", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateMailSetting();
    else if (check("updatemailserver", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateMailServer();
    else if (check("updatetasksetting", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateTaskSetting();
    else if (check("updatemapping", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateMapping();
    else if (check("updatecustomtag", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateCustomTag();
    else if (check("updateComponentMapping", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateComponentMapping();
    else if (check("stopThread", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doStopThread();
    else if (check("updatejavacfx", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateJavaCFX();
    else if (check("updatecppcfx", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateCPPCFX();
    else if (check("updatedebug", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateDebug();
    else if (check("updatedebugentry", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateDebugEntry();
    else if (check("updatedebugsetting", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateDebugSetting();
    else if (check("updateerror", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateError();
    else if (check("updateCustomTagSetting", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateCustomTagSetting();
    else if (check("updateExtension", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateExtension();
    else if (check("updateRHExtension", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateRHExtension();
    else if (check("removeRHExtension", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveRHExtension();
    else if (check("updateExtensionProvider", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateExtensionProvider();
    else if (check("updateRHExtensionProvider", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateRHExtensionProvider();
    else if (check("updateExtensionInfo", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateExtensionInfo();
    else if (check("updateGatewayEntry", ACCESS_NOT_WHEN_SERVER) && check2(ACCESS_WRITE))
        doUpdateGatewayEntry();
    else // else if(check("updateLogSettings", ACCESS_FREE) && check2(ACCESS_WRITE )) doUpdateUpdateLogSettings();
    if (check("updateMonitor", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doUpdateMonitor();
    else if (check("updateCacheHandler", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doUpdateCacheHandler();
    else if (check("updateORMEngine", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateORMEngine();
    else if (check("updateExecutionLog", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateExecutionLog();
    else // else if(check("removeproxy", ACCESS_NOT_WHEN_SERVER )) doRemoveProxy();
    if (check("removeMonitor", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doRemoveMonitor();
    else if (check("removeCacheHandler", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doRemoveCacheHandler();
    else if (check("removeORMEngine", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveORMEngine();
    else if (check("removebundle", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveBundle();
    else if (check("removeTLD", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveTLD();
    else if (check("removeFLD", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveFLD();
    else if (check("removeJDBCDriver", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveJDBCDriver();
    else if (check("removedatasource", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveDatasource();
    else if (check("removeCacheConnection", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveCacheConnection();
    else if (check("removeremoteclient", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveRemoteClient();
    else if (check("removeRemoteClientUsage", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveRemoteClientUsage();
    else if (check("removeSpoolerTask", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveSpoolerTask();
    else if (check("removeAllSpoolerTask", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveAllSpoolerTask();
    else // alias for executeSpoolerTask
    if (check("removeRemoteClientTask", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveSpoolerTask();
    else if (check("executeSpoolerTask", ACCESS_FREE) && check2(ACCESS_WRITE))
        doExecuteSpoolerTask();
    else // alias for executeSpoolerTask
    if (check("executeRemoteClientTask", ACCESS_FREE) && check2(ACCESS_WRITE))
        doExecuteSpoolerTask();
    else if (check("removemailserver", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveMailServer();
    else if (check("removemapping", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveMapping();
    else if (check("removecustomtag", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveCustomTag();
    else if (check("removecomponentmapping", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveComponentMapping();
    else if (check("removecfx", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveCFX();
    else if (check("removeExtension", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveExtension();
    else if (check("removeExtensionProvider", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveExtensionProvider();
    else if (check("removeRHExtensionProvider", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveRHExtensionProvider();
    else if (check("removeDefaultPassword", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveDefaultPassword();
    else if (check("removeGatewayEntry", ACCESS_NOT_WHEN_SERVER) && check2(ACCESS_WRITE))
        doRemoveGatewayEntry();
    else if (check("removeDebugEntry", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveDebugEntry();
    else if (check("removeCacheDefaultConnection", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveCacheDefaultConnection();
    else if (check("removeLogSetting", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveLogSetting();
    else if (check("storageGet", ACCESS_FREE) && check2(ACCESS_READ))
        doStorageGet();
    else if (check("storageSet", ACCESS_FREE) && check2(ACCESS_WRITE))
        doStorageSet();
    else if (check("getdefaultpassword", ACCESS_FREE) && check2(ACCESS_READ))
        doGetDefaultPassword();
    else if (check("getContexts", ACCESS_FREE) && check2(ACCESS_READ))
        doGetContexts();
    else if (check("getContextes", ACCESS_FREE) && check2(ACCESS_READ))
        doGetContexts();
    else if (check("updatedefaultpassword", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateDefaultPassword();
    else if (check("hasindividualsecurity", ACCESS_FREE) && check2(ACCESS_READ))
        doHasIndividualSecurity();
    else if (check("resetpassword", ACCESS_FREE) && check2(ACCESS_WRITE))
        doResetPassword();
    else if (check("stopThread", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doStopThread();
    else if (check("updateAuthKey", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doUpdateAuthKey();
    else if (check("removeAuthKey", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doRemoveAuthKey();
    else if (check("listAuthKey", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doListAuthKey();
    else if (check("updateAPIKey", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateAPIKey();
    else if (check("removeAPIKey", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveAPIKey();
    else if (check("getAPIKey", ACCESS_FREE) && check2(ACCESS_READ))
        doGetAPIKey();
    else if (check("createsecuritymanager", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doCreateSecurityManager();
    else if (check("getsecuritymanager", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_READ))
        doGetSecurityManager();
    else if (check("removesecuritymanager", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doRemoveSecurityManager();
    else if (check("getdefaultsecuritymanager", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_READ))
        doGetDefaultSecurityManager();
    else if (check("updatesecuritymanager", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doUpdateSecurityManager();
    else if (check("updatedefaultsecuritymanager", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doUpdateDefaultSecurityManager();
    else if (check("compileMapping", ACCESS_FREE) && check2(ACCESS_WRITE))
        doCompileMapping();
    else if (check("compileComponentMapping", ACCESS_FREE) && check2(ACCESS_WRITE))
        doCompileComponentMapping();
    else if (check("compileCTMapping", ACCESS_FREE) && check2(ACCESS_WRITE))
        doCompileCTMapping();
    else if (check("createArchive", ACCESS_FREE) && check2(ACCESS_WRITE))
        doCreateArchive(MAPPING_REGULAR);
    else if (check("createComponentArchive", ACCESS_FREE) && check2(ACCESS_WRITE))
        doCreateArchive(MAPPING_CFC);
    else if (check("createCTArchive", ACCESS_FREE) && check2(ACCESS_WRITE))
        doCreateArchive(MAPPING_CT);
    else if (check("reload", ACCESS_FREE) && check2(ACCESS_WRITE))
        doReload();
    else if (check("getResourceProviders", ACCESS_FREE) && check2(ACCESS_READ))
        doGetResourceProviders();
    else if (check("updateResourceProvider", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateResourceProvider();
    else if (check("updateDefaultResourceProvider", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateDefaultResourceProvider();
    else if (check("removeResourceProvider", ACCESS_FREE) && check2(ACCESS_WRITE))
        doRemoveResourceProvider();
    else if (check("getClusterClass", ACCESS_FREE) && check2(ACCESS_READ))
        doGetClusterClass();
    else if (check("updateClusterClass", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateClusterClass();
    else if (check("getAdminSyncClass", ACCESS_FREE) && check2(ACCESS_READ))
        doGetAdminSyncClass();
    else if (check("updateAdminSyncClass", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateAdminSyncClass();
    else if (check("getVideoExecuterClass", ACCESS_FREE) && check2(ACCESS_READ))
        doGetVideoExecuterClass();
    else if (check("updateVideoExecuterClass", ACCESS_FREE) && check2(ACCESS_WRITE))
        doUpdateVideoExecuterClass();
    else if (check("terminateRunningThread", ACCESS_FREE) && check2(ACCESS_WRITE))
        doTerminateRunningThread();
    else if (check("updateLabel", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doUpdateLabel();
    else if (check("restart", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doRestart();
    else if (check("runUpdate", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doRunUpdate();
    else if (check("removeUpdate", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doRemoveUpdate();
    else if (check("changeVersionTo", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doChangeVersionTo();
    else if (check("getUpdate", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doGetUpdate();
    else if (check("getMinVersion", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_READ))
        getMinVersion();
    else if (check("listPatches", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_READ))
        listPatches();
    else if (check("updateupdate", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doUpdateUpdate();
    else if (check("getSerial", ACCESS_FREE) && check2(ACCESS_READ))
        doGetSerial();
    else if (check("updateSerial", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doUpdateSerial();
    else if (check("heapDump", ACCESS_NOT_WHEN_WEB) && check2(ACCESS_WRITE))
        doHeapDump();
    else if (check("securitymanager", ACCESS_FREE) && check2(ACCESS_READ))
        doSecurityManager();
    else
        throw new ApplicationException("invalid action [" + action + "] for tag admin");
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) ApplicationException(lucee.runtime.exp.ApplicationException) ConfigServer(lucee.runtime.config.ConfigServer) ConfigImpl(lucee.runtime.config.ConfigImpl) PageException(lucee.runtime.exp.PageException) SecurityException(lucee.runtime.exp.SecurityException) IOException(java.io.IOException) DeprecatedException(lucee.runtime.exp.DeprecatedException) BundleException(org.osgi.framework.BundleException) MalformedURLException(java.net.MalformedURLException) SMTPException(lucee.runtime.net.mail.SMTPException) ApplicationException(lucee.runtime.exp.ApplicationException) Password(lucee.runtime.config.Password)

Example 32 with ConfigWebImpl

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

the class Admin method doSurveillance.

private void doSurveillance() throws PageException {
    // Server
    if (config instanceof ConfigServer) {
        ConfigServer cs = (ConfigServer) config;
        ConfigWeb[] webs = cs.getConfigWebs();
        Struct sct = new StructImpl();
        for (int i = 0; i < webs.length; i++) {
            ConfigWebImpl cw = (ConfigWebImpl) webs[i];
            try {
                sct.setEL(cw.getIdentification().getId(), ((CFMLFactoryImpl) cw.getFactory()).getInfo());
            } catch (Throwable t) {
                ExceptionUtil.rethrowIfNecessary(t);
            }
        }
        pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
    } else // Web
    {
        CFMLFactoryImpl factory = (CFMLFactoryImpl) ((ConfigWeb) config).getFactory();
        pageContext.setVariable(getString("admin", action, "returnVariable"), factory.getInfo());
    }
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) StructImpl(lucee.runtime.type.StructImpl) CFMLFactoryImpl(lucee.runtime.CFMLFactoryImpl) ConfigServer(lucee.runtime.config.ConfigServer) ConfigWeb(lucee.runtime.config.ConfigWeb) Struct(lucee.runtime.type.Struct)

Example 33 with ConfigWebImpl

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

the class Admin method fillGetRunningThreads.

private static void fillGetRunningThreads(lucee.runtime.type.Query qry, ConfigWeb configWeb) throws PageException {
    CFMLFactoryImpl factory = ((CFMLFactoryImpl) configWeb.getFactory());
    Map<Integer, PageContextImpl> pcs = factory.getActivePageContexts();
    Iterator<PageContextImpl> it = pcs.values().iterator();
    PageContextImpl pc;
    Collection.Key key;
    int row = 0;
    while (it.hasNext()) {
        pc = it.next();
        qry.addRow();
        row++;
        StackTraceElement[] st = pc.getThread().getStackTrace();
        configWeb.getConfigDir();
        configWeb.getIdentification().getId();
        configWeb.getConfigDir();
        qry.setAt("Id", row, new Double(pc.getId()));
        qry.setAt("Start", row, new DateTimeImpl(pc.getStartTime(), false));
        qry.setAt("Timeout", row, new Double(pc.getRequestTimeout() / 1000));
        qry.setAt("ThreadType", row, pc.getParentPageContext() == null ? "main" : "child");
        qry.setAt("StackTrace", row, toString(st));
        qry.setAt("TagContext", row, PageExceptionImpl.getTagContext(pc.getConfig(), st));
        qry.setAt("label", row, factory.getLabel());
        qry.setAt("RootPath", row, ReqRspUtil.getRootPath(((ConfigWebImpl) configWeb).getServletContext()));
        qry.setAt("ConfigFile", row, configWeb.getConfigFile().getAbsolutePath());
        if (factory.getURL() != null)
            qry.setAt("url", row, factory.getURL().toExternalForm());
    }
}
Also used : PageContextImpl(lucee.runtime.PageContextImpl) Key(lucee.runtime.type.Collection.Key) ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) CFMLFactoryImpl(lucee.runtime.CFMLFactoryImpl) BundleCollection(lucee.loader.osgi.BundleCollection) Collection(lucee.runtime.type.Collection) DateTimeImpl(lucee.runtime.type.dt.DateTimeImpl)

Example 34 with ConfigWebImpl

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

the class UDFPropertiesImpl method readExternal.

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    try {
        PageContextImpl pc = (PageContextImpl) ThreadLocalPageContext.get();
        ConfigWebImpl cw = (ConfigWebImpl) ThreadLocalPageContext.getConfig(pc);
        String path = ExternalizableUtil.readString(in);
        ps = PageSourceImpl.best(cw.getPageSources(pc, null, path, false, true, true));
    } catch (Exception e) {
        throw ExceptionUtil.toIOException(e);
    }
    startLine = in.readInt();
    endLine = in.readInt();
    arguments = (FunctionArgument[]) in.readObject();
    access = in.readInt();
    index = in.readInt();
    returnFormat = in.readInt();
    returnType = in.readInt();
    description = ExternalizableUtil.readString(in);
    displayName = ExternalizableUtil.readString(in);
    functionName = ExternalizableUtil.readString(in);
    hint = ExternalizableUtil.readString(in);
    meta = (Struct) in.readObject();
    output = in.readBoolean();
    bufferOutput = ExternalizableUtil.readBoolean(in);
    secureJson = ExternalizableUtil.readBoolean(in);
    strReturnFormat = ExternalizableUtil.readString(in);
    strReturnType = ExternalizableUtil.readString(in);
    verifyClient = ExternalizableUtil.readBoolean(in);
    cachedWithin = ExternalizableUtil.readString(in);
    int tmp = in.readInt();
    localMode = tmp == -1 ? null : tmp;
    if (arguments != null && arguments.length > 0) {
        this.argumentsSet = new HashSet<Collection.Key>();
        for (int i = 0; i < arguments.length; i++) {
            argumentsSet.add(arguments[i].getName());
        }
    }
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) PageContextImpl(lucee.runtime.PageContextImpl) IOException(java.io.IOException) Key(lucee.runtime.type.Collection.Key)

Example 35 with ConfigWebImpl

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

the class CFMLFactoryImpl method getInfo.

public Array getInfo() {
    Array info = new ArrayImpl();
    // synchronized (runningPcs) {
    // int len=runningPcs.size();
    Iterator<PageContextImpl> it = runningPcs.values().iterator();
    PageContextImpl pc;
    Struct data, sctThread, scopes;
    Thread thread;
    Entry<Integer, PageContextImpl> e;
    ConfigWebImpl cw;
    while (it.hasNext()) {
        pc = it.next();
        cw = (ConfigWebImpl) pc.getConfig();
        data = new StructImpl();
        sctThread = new StructImpl();
        scopes = new StructImpl();
        data.setEL("thread", sctThread);
        data.setEL("scopes", scopes);
        if (pc.isGatewayContext())
            continue;
        thread = pc.getThread();
        if (thread == Thread.currentThread())
            continue;
        thread = pc.getThread();
        if (thread == Thread.currentThread())
            continue;
        data.setEL("startTime", new DateTimeImpl(pc.getStartTime(), false));
        data.setEL("endTime", new DateTimeImpl(pc.getStartTime() + pc.getRequestTimeout(), false));
        data.setEL(KeyConstants._timeout, new Double(pc.getRequestTimeout()));
        // thread
        sctThread.setEL(KeyConstants._name, thread.getName());
        sctThread.setEL("priority", Caster.toDouble(thread.getPriority()));
        data.setEL("TagContext", PageExceptionImpl.getTagContext(pc.getConfig(), thread.getStackTrace()));
        data.setEL("urlToken", pc.getURLToken());
        try {
            if (pc.getConfig().debug())
                data.setEL("debugger", pc.getDebugger().getDebuggingData(pc));
        } catch (PageException e2) {
        }
        try {
            data.setEL(KeyConstants._id, Hash.call(pc, pc.getId() + ":" + pc.getStartTime()));
        } catch (PageException e1) {
        }
        data.setEL(KeyConstants._hash, cw.getHash());
        data.setEL("contextId", cw.getIdentification().getId());
        data.setEL(KeyConstants._label, cw.getLabel());
        data.setEL("requestId", pc.getId());
        // Scopes
        scopes.setEL(KeyConstants._name, pc.getApplicationContext().getName());
        try {
            scopes.setEL(KeyConstants._application, pc.applicationScope());
        } catch (PageException pe) {
        }
        try {
            scopes.setEL(KeyConstants._session, pc.sessionScope());
        } catch (PageException pe) {
        }
        try {
            scopes.setEL(KeyConstants._client, pc.clientScope());
        } catch (PageException pe) {
        }
        scopes.setEL(KeyConstants._cookie, pc.cookieScope());
        scopes.setEL(KeyConstants._variables, pc.variablesScope());
        if (!(pc.localScope() instanceof LocalNotSupportedScope)) {
            scopes.setEL(KeyConstants._local, pc.localScope());
            scopes.setEL(KeyConstants._arguments, pc.argumentsScope());
        }
        scopes.setEL(KeyConstants._cgi, pc.cgiScope());
        scopes.setEL(KeyConstants._form, pc.formScope());
        scopes.setEL(KeyConstants._url, pc.urlScope());
        scopes.setEL(KeyConstants._request, pc.requestScope());
        info.appendEL(data);
    }
    return info;
// }
}
Also used : PageException(lucee.runtime.exp.PageException) LocalNotSupportedScope(lucee.runtime.type.scope.LocalNotSupportedScope) ArrayImpl(lucee.runtime.type.ArrayImpl) Struct(lucee.runtime.type.Struct) Array(lucee.runtime.type.Array) ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) StructImpl(lucee.runtime.type.StructImpl) DateTimeImpl(lucee.runtime.type.dt.DateTimeImpl)

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