begin D196678.10.1
3832
public ConversationMetaData getMetaData()
   {
      if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getMetaData");
      if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getMetaData", metaData);      
      return metaData;   
   }
210427
@Override
    public void start(StartContext context) throws StartException {
        Set<KeytabService> services = keytabServices.getValue();

        hostServiceMap = new HashMap<String, KeytabService>(services.size()); // Assume at least one per service.
        /*
         * Iterate the services and find the first one to offer default resolution, also create a hostname to KeytabService map
         * for the first one that claims each host.
         */
        for (KeytabService current : services) {
            for (String currentHost : current.getForHosts()) {
                if ("*".equals(currentHost)) {
                    if (defaultService == null) {
                        defaultService = current;
                    }
                } else if (currentHost != null) {
                    int idx = currentHost.indexOf("/");
                    String hostKey = idx > -1 ? currentHost.substring(0, idx) + "/" + currentHost.substring(idx + 1).toLowerCase(Locale.ENGLISH) :
                        currentHost.toLowerCase(Locale.ENGLISH);
                    if (hostServiceMap.containsKey(hostKey) == false) {
                        hostServiceMap.put(hostKey, current);
                    }
                }
            }
        }

        /*
         * Iterate the services again and attempt to identify host names from the principal name and add to the map if there is
         * not already a mapping for that host name.
         */
        for (KeytabService current : services) {
            String principal = current.getPrincipal();
            int start = principal.indexOf('/');
            int end = principal.indexOf('@');

            String currentHost = principal.substring(start > -1 ? start + 1 : 0, end > -1 ? end : principal.length() - 1);
            if (hostServiceMap.containsKey(currentHost.toLowerCase(Locale.ENGLISH)) == false) {
                hostServiceMap.put(currentHost.toLowerCase(Locale.ENGLISH), current);
            }
            principal = principal.substring(0, end > -1 ? end : principal.length() - 1);
            if (principal.equals(currentHost) == false) {
                String principalKey = principal.substring(0, start) + "/" + currentHost.toLowerCase(Locale.ENGLISH);
                if (hostServiceMap.containsKey(principalKey) == false) {
                    hostServiceMap.put(principalKey, current);
                }
            }
        }
    }
448303
@Override
    public void activate(ComponentContext context,
                         Map<String, Object> properties, ConfigurationAdmin configAdmin) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, "activate", new Object[] { context, properties,
                                                      configAdmin });
        }
        try {
            // set ME state to starting
            _state = ME_STATE.STARTING.toString();

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                SibTr.debug(this, tc, "Starting the JMS server.");
            }

            // initilize config object
            initialize(context, properties, configAdmin);

            _jsMainImpl = new JsMainImpl(context.getBundleContext());
            _jsMainImpl.initialize(jsMEConfig);
            _jsMainImpl.start();

            // If its here it means all the components have started hence set
            // the state to STARTED
            _state = ME_STATE.STARTED.toString();
            SibTr.info(tc, "ME_STARTED_SIAS0108");
        } catch (InvalidFileStoreConfigurationException ifs) {
            // since there is exception in starting ME the state is set to
            // STOPPED
            _state = ME_STATE.STOPPED.toString();

            SibTr.error(tc, "ME_STOPPED_SIAS0109");
            SibTr.exception(tc, ifs);
            FFDCFilter.processException(ifs,
                                        "com.ibm.ws.messaging.service.JsMainAdminServiceImpl",
                                        "132", this);
        } catch (Exception e) {
            // since there is exception in starting ME the state is set to
            // STOPPED
            _state = ME_STATE.STOPPED.toString();

            SibTr.error(tc, "ME_STOPPED_SIAS0109");
            SibTr.exception(tc, e);
            FFDCFilter.processException(e,
                                        "com.ibm.ws.messaging.service.JsMainAdminServiceImpl",
                                        "139", this);

        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, "activate");
        }
    }
1177493
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 (action.equals("getextension")) {
	    if (type == TYPE_SERVER) doGetRHServerExtension();
	    else doGetRHExtension();
	    return;
	}
	if (action.equals("getextensions") || action.equals("getrhextensions")) {
	    if (type == TYPE_SERVER) doGetRHServerExtensions();
	    else doGetRHExtensions();
	    return;
	}
	if (action.equals("getserverextensions") || action.equals("getrhserverextensions")) {
	    doGetRHServerExtensions();
	    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());
	    return; // do not remove
	}

	try {
	    // Password
	    String strPW = getString("password", "");
	    Password tmp = type == TYPE_SERVER ? ((ConfigWebImpl) config).isServerPasswordEqual(strPW) : config.isPasswordEqual(strPW); // hash password if
																	// necessary (for
																	// backward
																	// 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("getDevelopMode", ACCESS_FREE) && check2(ACCESS_READ)) doGetDevelopMode();
	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();

	// alias for getSpoolerTasks
	else 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)) // no password necessary for this
	    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("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) || check("getExtensionProviders", 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("getJavaCfxTags", ACCESS_FREE) && check2(ACCESS_READ)) doGetJavaCFXTags();
	else if (check("getDebug", ACCESS_FREE) && check2(ACCESS_READ)) doGetDebug();
	else if (check("getDebugEntry", ACCESS_FREE)) 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("updateDevelopMode", ACCESS_FREE) && check2(ACCESS_WRITE)) doUpdateDevelopMode();
	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("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) || check("updateExtension", ACCESS_FREE)) && check2(ACCESS_WRITE)) doUpdateRHExtension();
	else if ((check("removeRHExtension", ACCESS_FREE) || check("removeExtension", ACCESS_FREE)) && check2(ACCESS_WRITE)) doRemoveRHExtension();
	else if (check("updateExtensionProvider", ACCESS_FREE) && check2(ACCESS_WRITE)) doUpdateExtensionProvider();
	else if ((check("updateRHExtensionProvider", ACCESS_FREE) || check("updateExtensionProvider", 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 if(check("updateLogSettings", ACCESS_FREE) && check2(ACCESS_WRITE ))
	// doUpdateUpdateLogSettings();
	else 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 if(check("removeproxy", ACCESS_NOT_WHEN_SERVER )) doRemoveProxy();
	else 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();
	// alias for executeSpoolerTask
	else if (check("removeRemoteClientTask", ACCESS_FREE) && check2(ACCESS_WRITE)) doRemoveSpoolerTask();
	else if (check("executeSpoolerTask", ACCESS_FREE) && check2(ACCESS_WRITE)) doExecuteSpoolerTask();
	// alias for executeSpoolerTask
	else 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");

    }
635009
public void start() throws Exception {
        bundleClassResolverHelper = new BundleClassResolverHelper(bundleContext);
        bundleClassResolverHelper.setApplicationName(applicationName);
        bundleClassResolverHelper.register();
    }
825692
function () {

                // Restart button click handler
                var restartBtnClicked = function () {
                    HealthLogger.sendAnalyticsData(
                        autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_RESTART,
                        "autoUpdate",
                        "installNotification",
                        "installNow ",
                        "click"
                    );
                    detachUpdateBarBtnHandlers();
                    initiateUpdateProcess(statusObj.installerPath, statusObj.logFilePath, statusObj.installStatusFilePath);
                };

                // Later button click handler
                var laterBtnClicked = function () {
                    HealthLogger.sendAnalyticsData(
                        autoUpdateEventNames.AUTOUPDATE_DOWNLOAD_COMPLETE_USER_CLICK_LATER,
                        "autoUpdate",
                        "installNotification",
                        "cancel",
                        "click"
                    );
                    detachUpdateBarBtnHandlers();
                    setUpdateStateInJSON('updateInitiatedInPrevSession', false);
                };

                //attaching UpdateBar handlers
                UpdateInfoBar.on(UpdateInfoBar.RESTART_BTN_CLICKED, restartBtnClicked);
                UpdateInfoBar.on(UpdateInfoBar.LATER_BTN_CLICKED, laterBtnClicked);

                UpdateInfoBar.showUpdateBar({
                    title: Strings.DOWNLOAD_COMPLETE,
                    description: Strings.CLICK_RESTART_TO_UPDATE,
                    needButtons: true
                });

                setUpdateStateInJSON("autoUpdateInProgress", false);
                HealthLogger.sendAnalyticsData(
                    autoUpdateEventNames.AUTOUPDATE_DOWNLOADCOMPLETE_UPDATE_BAR_RENDERED,
                    "autoUpdate",
                    "installNotification",
                    "render",
                    ""
                );
            }
513477
@Trivial
    protected void activate(ComponentContext context) throws Exception {
        Dictionary<String, ?> props = context.getProperties();
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(this, tc, "activate", props);

        adminObjectImplClassName = (String) props.get(CONFIG_PROPS_PREFIX + "adminobject-class");
        name = (String) props.get("config.id");
        id = (String) props.get("id");
        jndiName = (String) props.get("jndiName");

        for (Enumeration<String> keys = props.keys(); keys.hasMoreElements();) {
            String key = keys.nextElement();
            if (key.length() > CONFIG_PROPS_PREFIX_LENGTH && key.charAt(CONFIG_PROPS_PREFIX_LENGTH - 1) == '.' && key.startsWith(CONFIG_PROPS_PREFIX)) {
                String propName = key.substring(CONFIG_PROPS_PREFIX_LENGTH);
                if (propName.indexOf('.') < 0 && propName.indexOf('-') < 0)
                    properties.put(propName, props.get(key));
            }
        }

        bootstrapContextRef.activate(context);

        if (trace && tc.isEntryEnabled())
            Tr.exit(this, tc, "activate");
    }
426801
def run
      # 1. Load configuration settings
      options = OptionsBag.load
      agent_id  = options[:identity]
      AgentConfig.root_dir = options[:root_dir]

      Log.program_name = 'RightLink'
      Log.facility = 'user'
      Log.log_to_file_only(options[:log_to_file_only])
      Log.init(agent_id, options[:log_path])
      Log.level = CookState.log_level
      # add an additional logger if the agent is set to log to an alternate 
      # location (install, operate, decommission, ...)
      Log.add_logger(::Logger.new(CookState.log_file)) if CookState.log_file

      Log.info("[cook] Process starting up with dev tags: [#{CookState.startup_tags.select { |tag| tag.include?(CookState::DEV_TAG_NAMESPACE)}.join(', ')}]")
      fail('Missing command server listen port') unless options[:listen_port]
      fail('Missing command cookie') unless options[:cookie]
      @client = CommandClient.new(options[:listen_port], options[:cookie])
      ShutdownRequestProxy.init(@client)

      # 2. Retrieve bundle
      input = gets.chomp
      begin
        platform = RightScale::Platform
        if platform.windows?
          bundle = MessageEncoder::SecretSerializer.new(InstanceState.identity, ENV[ExecutableSequenceProxy::DECRYPTION_KEY_NAME]).load(input)
        else
          bundle = MessageEncoder::Serializer.new.load(input)
        end
      rescue Exception => e
        fail('Invalid bundle', e.message)
      end

      fail('Missing bundle', 'No bundle to run') if bundle.nil?

      @thread_name = bundle.runlist_policy.thread_name if bundle.respond_to?(:runlist_policy) && bundle.runlist_policy
      @thread_name ||= RightScale::AgentConfig.default_thread_name
      options[:thread_name] = @thread_name

      # Chef state needs the server secret so it can encrypt state on disk.
      # The secret is the same for all instances of the server (i.e. is still
      # valid after stop and restart server).
      server_secret = bundle.server_secret || AgentConfig.default_server_secret
      ChefState.init(agent_id, server_secret, reset=false)

      # 3. Run bundle
      @@instance = self
      success = nil
      Log.debug("[cook] Thread name associated with bundle = #{@thread_name}")
      gatherer = ExternalParameterGatherer.new(bundle, options)
      sequence = ExecutableSequence.new(bundle)
      EM.threadpool_size = 1
      EM.error_handler do |e|
        Log.error("Execution failed", e, :trace)
        fail('Exception caught', "The following exception was caught during execution:\n  #{e.message}")
      end
      EM.run do
        begin
          AuditStub.instance.init(options)
          check_for_missing_inputs(bundle)
          gatherer.callback { EM.defer { sequence.run } }
          gatherer.errback { success = false; report_failure(gatherer) }
          sequence.callback { success = true; send_inputs_patch(sequence) }
          sequence.errback { success = false; report_failure(sequence) }

          EM.defer { gatherer.run }
        rescue Exception => e
          fail('Execution failed', Log.format("Execution failed", e, :trace))
        end
      end

    rescue Exception => e
      fail('Execution failed', Log.format("Run failed", e, :trace))

    ensure
      Log.info("[cook] Process stopping")
      exit(1) unless success
    end
280346
private void addBasicStep(OperationContext context, ModelNode operation, ModelNode localReponse) throws OperationFailedException {
        final String operationName = operation.require(OP).asString();
        final PathAddress pathAddress = PathAddress.pathAddress(operation.get(OP_ADDR));
        final OperationEntry entry = context.getRootResourceRegistration().getOperationEntry(pathAddress, operationName);
        if (entry != null) {
            if (!context.isBooting()
                    && entry.getType() == OperationEntry.EntryType.PRIVATE
                    && operation.hasDefined(OPERATION_HEADERS, CALLER_TYPE)
                    && USER.equals(operation.get(OPERATION_HEADERS, CALLER_TYPE).asString())) {
                throw new OperationFailedException(ControllerLogger.ROOT_LOGGER.noHandlerForOperation(operationName, pathAddress));
            }
            if (context.isBooting() || localHostControllerInfo.isMasterDomainController()) {
                context.addModelStep(localReponse, operation, entry.getOperationDefinition(), entry.getOperationHandler(), false);
            } else {
                final OperationStepHandler wrapper;
                // For slave host controllers wrap the operation handler to synchronize missing configuration
                // TODO better configuration of ignore unaffected configuration
                if (localHostControllerInfo.isRemoteDomainControllerIgnoreUnaffectedConfiguration()) {
                    final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
                    wrapper = SyncModelOperationHandlerWrapper.wrapHandler(localHostControllerInfo.getLocalHostName(), operationName, address, entry);
                } else {
                    wrapper = entry.getOperationHandler();
                }
                context.addModelStep(localReponse, operation, entry.getOperationDefinition(), wrapper, false);
            }
        } else {
            throw new OperationFailedException(ControllerLogger.ROOT_LOGGER.noHandlerForOperation(operationName, pathAddress));
        }
    }
494198
@SuppressWarnings({ "rawtypes", "unchecked" })
    public void start() throws Exception {
        factory =
            new DefaultWebApplicationFactory(bundleContext, applicationClass, applicationName, mountPoint,
                contextParams);
        factory.register();
        LOGGER.info("Successfully registered application factory");
    }
612202
def _start(self):
        """"""
        cls = self._get_manager_class(register_callables=True)
        ins = cls(address=self.addr, authkey=self.authkey)
        ins.start()
        return ins
1211221
def step1(self, pin):
        """"""
        context = SRPContext(
            'Pair-Setup', str(pin),
            prime=constants.PRIME_3072,
            generator=constants.PRIME_3072_GEN,
            hash_func=hashlib.sha512)
        self._session = SRPClientSession(
            context, binascii.hexlify(self._auth_private).decode())
1155102
async def main() -> None:
    """"""

    loglevels = dict((logging.getLevelName(level), level)
                     for level in [10, 20, 30, 40, 50])

    logging.basicConfig(
        level=loglevels[LOGLEVEL],
        format='%(asctime)s:%(levelname)s:\t%(name)s\t%(message)s')

    async with ClientSession() as websession:
        try:
            myq = await pymyq.login(
                MYQ_ACCOUNT_EMAIL, MYQ_ACCOUNT_PASSWORD, MYQ_BRAND, websession)

            devices = await myq.get_devices()
            for idx, device in enumerate(devices):
                print('Device #{0}: {1}'.format(idx + 1, device.name))
                print('--------')
                print('Brand: {0}'.format(device.brand))
                print('Type: {0}'.format(device.type))
                print('Serial: {0}'.format(device.serial))
                print('Device ID: {0}'.format(device.device_id))
                print('Parent ID: {0}'.format(device.parent_id))
                print('Online: {0}'.format(device.available))
                print('Unattended Open: {0}'.format(device.open_allowed))
                print('Unattended Close: {0}'.format(device.close_allowed))
                print()
                print('Current State: {0}'.format(device.state))
                if JSON_DUMP:
                    print(json.dumps(device._device, indent=4))
                else:
                    if device.state != STATE_OPEN:
                        print('Opening the device...')
                        await device.open()
                        print('    0 Current State: {0}'.format(device.state))
                        for waited in range(1, 30):
                            if device.state == STATE_OPEN:
                                break
                            await asyncio.sleep(1)
                            await device.update()
                            print('    {} Current State: {}'.format(
                                waited, device.state))

                        await asyncio.sleep(10)
                        await device.update()
                        print()
                        print('Current State: {0}'.format(device.state))

                    if device.state != STATE_CLOSED:
                        print('Closing the device...')
                        await device.close()
                        print('    0 Current State: {0}'.format(device.state))
                        for waited in range(1, 30):
                            if device.state == STATE_CLOSED:
                                break
                            await asyncio.sleep(1)
                            await device.update()
                            print('    {} Current State: {}'.format(
                                waited, device.state))

                        await asyncio.sleep(10)
                        await device.update()
                        print()
                        print('Current State: {0}'.format(device.state))
        except MyQError as err:
            print(err)
375185
async function initialize(dispatch) {
	shimInit();

	// blobTest();

	Setting.setConstant('env', __DEV__ ? 'dev' : 'prod');
	Setting.setConstant('appId', 'net.cozic.joplin-mobile');
	Setting.setConstant('appType', 'mobile');
	//Setting.setConstant('resourceDir', () => { return RNFetchBlob.fs.dirs.DocumentDir; });
	Setting.setConstant('resourceDir', RNFetchBlob.fs.dirs.DocumentDir);

	const logDatabase = new Database(new DatabaseDriverReactNative());
	await logDatabase.open({ name: 'log.sqlite' });
	await logDatabase.exec(Logger.databaseCreateTableSql());

	const mainLogger = new Logger();
	mainLogger.addTarget('database', { database: logDatabase, source: 'm' });
	mainLogger.setLevel(Logger.LEVEL_INFO);
	
	if (Setting.value('env') == 'dev') {
		mainLogger.addTarget('console');
		mainLogger.setLevel(Logger.LEVEL_DEBUG);
	}

	reg.setLogger(mainLogger);
	reg.setShowErrorMessageBoxHandler((message) => { alert(message) });

	BaseService.logger_ = mainLogger;

	reg.logger().info('====================================');
	reg.logger().info('Starting application ' + Setting.value('appId') + ' (' + Setting.value('env') + ')');

	const dbLogger = new Logger();
	dbLogger.addTarget('database', { database: logDatabase, source: 'm' }); 
	if (Setting.value('env') == 'dev') {
		dbLogger.addTarget('console');
		dbLogger.setLevel(Logger.LEVEL_INFO); // Set to LEVEL_DEBUG for full SQL queries
	} else {
		dbLogger.setLevel(Logger.LEVEL_INFO);
	}

	let db = new JoplinDatabase(new DatabaseDriverReactNative());
	db.setLogger(dbLogger);
	reg.setDb(db);

	reg.dispatch = dispatch;
	BaseModel.dispatch = dispatch;
	FoldersScreenUtils.dispatch = dispatch;
	BaseSyncTarget.dispatch = dispatch;
	NavService.dispatch = dispatch;
	BaseModel.db_ = db;

	BaseItem.loadClass('Note', Note);
	BaseItem.loadClass('Folder', Folder);
	BaseItem.loadClass('Resource', Resource);
	BaseItem.loadClass('Tag', Tag);
	BaseItem.loadClass('NoteTag', NoteTag);
	BaseItem.loadClass('MasterKey', MasterKey);
	BaseItem.loadClass('Revision', Revision);

	const fsDriver = new FsDriverRN();

	Resource.fsDriver_ = fsDriver;
	FileApiDriverLocal.fsDriver_ = fsDriver;

	AlarmService.setDriver(new AlarmServiceDriver());
	AlarmService.setLogger(mainLogger);

	try {
		if (Setting.value('env') == 'prod') {
			await db.open({ name: 'joplin.sqlite' })
		} else {
			await db.open({ name: 'joplin-68.sqlite' })
		}

		reg.logger().info('Database is ready.');
		reg.logger().info('Loading settings...');
		await Setting.load();

		if (Setting.value('firstStart')) {
			let locale = NativeModules.I18nManager.localeIdentifier
			if (!locale) locale = defaultLocale();
			Setting.setValue('locale', closestSupportedLocale(locale));
			if (Setting.value('env') === 'dev') Setting.setValue('sync.target', SyncTargetRegistry.nameToId('onedrive_dev'));
			Setting.setValue('firstStart', 0);
		}

		if (Setting.value('db.ftsEnabled') === -1) {
			const ftsEnabled = await db.ftsEnabled();
			Setting.setValue('db.ftsEnabled', ftsEnabled ? 1 : 0);
			reg.logger().info('db.ftsEnabled = ', Setting.value('db.ftsEnabled'));
		}

		BaseItem.revisionService_ = RevisionService.instance();

		// Note: for now we hard-code the folder sort order as we need to 
		// create a UI to allow customisation (started in branch mobile_add_sidebar_buttons)
		Setting.setValue('folders.sortOrder.field', 'title');
		Setting.setValue('folders.sortOrder.reverse', false);

		reg.logger().info('Sync target: ' + Setting.value('sync.target'));

		setLocale(Setting.value('locale'));

		// ----------------------------------------------------------------
		// E2EE SETUP
		// ----------------------------------------------------------------

		EncryptionService.fsDriver_ = fsDriver;
		EncryptionService.instance().setLogger(mainLogger);
		BaseItem.encryptionService_ = EncryptionService.instance();
		DecryptionWorker.instance().dispatch = dispatch;
		DecryptionWorker.instance().setLogger(mainLogger);
		DecryptionWorker.instance().setEncryptionService(EncryptionService.instance());
		await EncryptionService.instance().loadMasterKeysFromSettings();

		// ----------------------------------------------------------------
		// / E2EE SETUP
		// ----------------------------------------------------------------

		reg.logger().info('Loading folders...');

		await FoldersScreenUtils.refreshFolders();

		const tags = await Tag.allWithNotes();

		dispatch({
			type: 'TAG_UPDATE_ALL',
			items: tags,
		});

		const masterKeys = await MasterKey.all();

		dispatch({
			type: 'MASTERKEY_UPDATE_ALL',
			items: masterKeys,
		});

		let folderId = Setting.value('activeFolderId');
		let folder = await Folder.load(folderId);

		if (!folder) folder = await Folder.defaultFolder();

		dispatch({
			type: 'FOLDER_SET_COLLAPSED_ALL',
			ids: Setting.value('collapsedFolderIds'),
		});

		if (!folder) {
			dispatch({
				type: 'NAV_GO',
				routeName: 'Welcome',
			});
		} else {
			dispatch({
				type: 'NAV_GO',
				routeName: 'Notes',
				folderId: folder.id,
			});
		}
	} catch (error) {
		alert('Initialization error: ' + error.message);
		reg.logger().error('Initialization error:', error);
	}

	reg.setupRecurrentSync();

	PoorManIntervals.setTimeout(() => {
		AlarmService.garbageCollect();
	}, 1000 * 60 * 60);

	ResourceService.runInBackground();

	ResourceFetcher.instance().setFileApi(() => { return reg.syncTarget().fileApi() });
	ResourceFetcher.instance().setLogger(reg.logger());
	ResourceFetcher.instance().start();

	SearchEngine.instance().setDb(reg.db());
	SearchEngine.instance().setLogger(reg.logger());
	SearchEngine.instance().scheduleSyncTables();

	reg.scheduleSync().then(() => {
		// Wait for the first sync before updating the notifications, since synchronisation
		// might change the notifications.
		AlarmService.updateAllNotifications();

		DecryptionWorker.instance().scheduleStart();
	});

	await WelcomeUtils.install(dispatch);

	// Collect revisions more frequently on mobile because it doesn't auto-save
	// and it cannot collect anything when the app is not active.
	RevisionService.instance().runInBackground(1000 * 30);

	reg.logger().info('Application initialized');
}
1370582
public void start() throws Exception {
        internalPageFactory =
            new InternalPageFactory(bundleContext, pageId, applicationName, pageName, pageClass, overwrites,
                injectionSource);
        internalPageFactory.register();
    }
807477
@BeforeClass
    public static void setUp() throws Exception {
        // Add LDAP variables to bootstrap properties file
        LDAPUtils.addLDAPVariables(server);
        Log.info(c, "setUp", "Starting the server... (will wait for userRegistry servlet to start)");
        server.copyFileToLibertyInstallRoot("lib/features", "internalfeatures/securitylibertyinternals-1.0.mf");
        server.addInstalledAppForValidation("userRegistry");
        server.startServer(c.getName() + ".log");

        //Make sure the application has come up before proceeding
        assertNotNull("Application userRegistry does not appear to have started.",
                      server.waitForStringInLog("CWWKZ0001I:.*userRegistry"));
        assertNotNull("Security service did not report it was ready",
                      server.waitForStringInLog("CWWKS0008I"));
        assertNotNull("Server did not came up",
                      server.waitForStringInLog("CWWKF0011I"));

        Log.info(c, "setUp", "Creating servlet connection the server");
        servlet = new UserRegistryServletConnection(server.getHostname(), server.getHttpDefaultPort());

        if (servlet.getRealm() == null) {
            Thread.sleep(5000);
            servlet.getRealm();
        }
    }
756293
def run(self):
        
        logging.info('start run with "{}" at {}'.format(
            self.username, datetime.datetime.now()))
        progress = Progress(text="Controllo requisiti software...",
                            pulsate=True, auto_close=True)
        progress(1)
        try:
            self.requirements()
        except LockFailedException as lfe:
            ErrorMessage('Errore "{}" probabilmente l\'utente {} non ha i'
                         ' diritti di amministratore'.format(lfe,
                                                             self.username))
            sys.exit(20)
        except Exception as e:
            ErrorMessage("Si e' verificato un errore generico: {}".format(e))
            sys.exit(21)
        progress(100)

        self.set_shares()
        # richiesta username del dominio
        insert_msg = "Inserisci l'utente del Dominio/Posta Elettronica"
        default_username = (self.host_username if self.host_username
                            else os.environ['USER'])
        self.domain_username = GetText(text=insert_msg,
                                       entry_text=self.username)

        if self.domain_username is None or len(self.domain_username) == 0:
            error_msg = "Inserimento di un username di dominio vuoto"
            ErrorMessage(self.msg_error % error_msg)
            sys.exit(2)

        # richiesta della password di dominio
        insert_msg = u"Inserisci la password del Dominio/Posta Elettronica"
        self.domain_password = GetText(text=insert_msg,
                                       entry_text='password',
                                       password=True)

        if self.domain_password is None or len(self.domain_password) == 0:
            error_msg = u"Inserimento di una password di dominio vuota"
            ErrorMessage(self.msg_error % error_msg)
            sys.exit(3)

        progress_msg = u"Collegamento unità di rete in corso..."
        progress = Progress(text=progress_msg,
                            pulsate=True,
                            auto_close=True)
        progress(1)
        # ciclo per montare tutte le condivisioni
        result = []
        for share in self.samba_shares:
            # print("#######")
            # print(share)
            if 'mountpoint' not in share.keys():
                # creazione stringa che rappresente il mount-point locale
                mountpoint = os.path.expanduser(
                    '~%s/%s/%s' % (self.host_username,
                                   share['hostname'],
                                   share['share']))
                share.update({'mountpoint': mountpoint})
            elif not share['mountpoint'].startswith('/'):
                mountpoint = os.path.expanduser(
                    '~%s/%s' % (self.host_username, share['mountpoint']))
                share.update({'mountpoint': mountpoint})

            share.update({
                'host_username': self.host_username,
                'domain_username': share.get(
                    'username', self.domain_username),
                'domain_password': share.get(
                    'password', self.domain_password)})

            # controllo che il mount-point locale esista altrimenti non
            # viene creato
            if not os.path.exists(share['mountpoint']):
                if self.verbose:
                    logging.warning('Mountpoint "%s" not exist.' %
                                    share['mountpoint'])
                if not self.dry_run:
                    os.makedirs(share['mountpoint'])

            # smonto la condivisione prima di rimontarla
            umont_cmd = self.cmd_umount % share
            if self.verbose:
                logging.warning("Umount command: %s" % umont_cmd)
            if not self.dry_run:
                umount_p = subprocess.Popen(umont_cmd,
                                            shell=True)
                returncode = umount_p.wait()
                time.sleep(2)

            mount_cmd = self.cmd_mount % share
            if self.verbose:
                placeholder = ",password="
                logging.warning("Mount command: %s%s" % (mount_cmd.split(
                    placeholder)[0], placeholder + "******\""))

            # print(mount_cmd)
            # print("#######")
            if not self.dry_run:
                # montaggio della condivisione
                p_mnt = subprocess.Popen(mount_cmd, shell=True,
                                         stdout=subprocess.PIPE,
                                         stderr=subprocess.PIPE)
                returncode = p_mnt.wait()
                result.append({'share': share['share'],
                               'returncode': returncode,
                               'stdout': p_mnt.stdout.read(),
                               'stderr': p_mnt.stderr.read()})
        progress(100)
        if self.verbose:
            logging.warning("Risultati: %s" % result)