Search in sources :

Example 1 with CmsFlexCache

use of org.opencms.flex.CmsFlexCache in project opencms-core by alkacon.

the class CmsFlexCacheClearDialog method defineWidgets.

/**
 * Creates the list of widgets for this dialog.<p>
 */
@Override
protected void defineWidgets() {
    setKeyPrefix(KEY_PREFIX);
    // initialize the cache object to use for the dialog
    CmsFlexController controller = (CmsFlexController) getJsp().getRequest().getAttribute(CmsFlexController.ATTRIBUTE_NAME);
    CmsFlexCache cache = controller.getCmsCache();
    setOffline(true);
    setOnline(true);
    setMode(MODE_ALL);
    // widgets to display
    if (cache.cacheOffline()) {
        addWidget(new CmsWidgetDialogParameter(this, "offline", PAGES[0], new CmsCheckboxWidget()));
    }
    addWidget(new CmsWidgetDialogParameter(this, "online", PAGES[0], new CmsCheckboxWidget()));
    addWidget(new CmsWidgetDialogParameter(this, "mode", PAGES[0], new CmsRadioSelectWidget(getModes())));
}
Also used : CmsWidgetDialogParameter(org.opencms.workplace.CmsWidgetDialogParameter) CmsFlexController(org.opencms.flex.CmsFlexController) CmsFlexCache(org.opencms.flex.CmsFlexCache) CmsCheckboxWidget(org.opencms.widgets.CmsCheckboxWidget) CmsRadioSelectWidget(org.opencms.widgets.CmsRadioSelectWidget)

Example 2 with CmsFlexCache

use of org.opencms.flex.CmsFlexCache in project opencms-core by alkacon.

the class CmsFlexCacheClearDialog method createDialogHtml.

/**
 * Creates the dialog HTML for all defined widgets of the named dialog (page).<p>
 *
 * This overwrites the method from the super class to create a layout variation for the widgets.<p>
 *
 * @param dialog the dialog (page) to get the HTML for
 * @return the dialog HTML for all defined widgets of the named dialog (page)
 */
@Override
protected String createDialogHtml(String dialog) {
    StringBuffer result = new StringBuffer(1024);
    // create widget table
    result.append(createWidgetTableStart());
    // show error header once if there were validation errors
    result.append(createWidgetErrorHeader());
    int n = 1;
    // initialize the cache object to use for the dialog
    CmsFlexController controller = (CmsFlexController) getJsp().getRequest().getAttribute(CmsFlexController.ATTRIBUTE_NAME);
    CmsFlexCache cache = controller.getCmsCache();
    // widgets to display
    if (cache.cacheOffline()) {
        n = 2;
    }
    if (dialog.equals(PAGES[0])) {
        // create the widgets for the first dialog page
        result.append(dialogBlockStart(key(Messages.GUI_FLEXCACHE_LABEL_CLEAN_BLOCK_0)));
        result.append(createWidgetTableStart());
        result.append(createDialogRowsHtml(0, n));
        result.append(createWidgetTableEnd());
        result.append(dialogBlockEnd());
    }
    // close widget table
    result.append(createWidgetTableEnd());
    return result.toString();
}
Also used : CmsFlexController(org.opencms.flex.CmsFlexController) CmsFlexCache(org.opencms.flex.CmsFlexCache)

Example 3 with CmsFlexCache

use of org.opencms.flex.CmsFlexCache in project opencms-core by alkacon.

the class CmsFlexCacheList method fillDetails.

/**
 * @see org.opencms.workplace.list.A_CmsListDialog#fillDetails(java.lang.String)
 */
@Override
protected void fillDetails(String detailId) {
    CmsObject cms = getCms();
    CmsFlexController controller = (CmsFlexController) getJsp().getRequest().getAttribute(CmsFlexController.ATTRIBUTE_NAME);
    CmsFlexCache cache = controller.getCmsCache();
    // get content
    List entries = getList().getAllContent();
    Iterator itEntries = entries.iterator();
    while (itEntries.hasNext()) {
        CmsListItem item = (CmsListItem) itEntries.next();
        String resName = item.getId();
        StringBuffer html = new StringBuffer(512);
        try {
            if (detailId.equals(LIST_DETAIL_VARIATIONS)) {
                // variations
                List variations = new ArrayList(cache.getCachedVariations(resName, cms));
                Collections.sort(variations);
                Iterator itVariations = variations.iterator();
                while (itVariations.hasNext()) {
                    String var = (String) itVariations.next();
                    html.append(var);
                    if (itVariations.hasNext()) {
                        html.append("<br>");
                    }
                    html.append("\n");
                }
            } else {
                continue;
            }
        } catch (Exception e) {
        // ignore
        }
        item.set(detailId, html.toString());
    }
}
Also used : CmsListItem(org.opencms.workplace.list.CmsListItem) CmsObject(org.opencms.file.CmsObject) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) CmsFlexController(org.opencms.flex.CmsFlexController) CmsFlexCache(org.opencms.flex.CmsFlexCache) ArrayList(java.util.ArrayList) List(java.util.List) CmsRuntimeException(org.opencms.main.CmsRuntimeException)

Example 4 with CmsFlexCache

use of org.opencms.flex.CmsFlexCache in project opencms-core by alkacon.

the class OpenCmsCore method initConfiguration.

/**
 * Constructor to create a new OpenCms object.<p>
 *
 * It reads the configurations from the <code>opencms.properties</code>
 * file in the <code>config/</code> subdirectory. With the information
 * from this file is inits a ResourceBroker (Database access module),
 * various caching systems and other options.<p>
 *
 * This will only be done once per accessing class.
 *
 * @param configuration the configurations from the <code>opencms.properties</code> file
 * @throws CmsInitException in case OpenCms can not be initialized
 */
protected synchronized void initConfiguration(CmsParameterConfiguration configuration) throws CmsInitException {
    String serverInfo = configuration.getString("context.servlet.container", null);
    // output startup message to log file
    if (CmsLog.INIT.isInfoEnabled()) {
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DOT_0));
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DOT_0));
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DOT_0));
        CmsLog.INIT.info(". " + Messages.get().getBundle().key(Messages.GUI_SHELL_VERSION_1, OpenCms.getSystemInfo().getVersionNumber()));
        for (int i = 0; i < Messages.COPYRIGHT_BY_ALKACON.length; i++) {
            CmsLog.INIT.info(". " + Messages.COPYRIGHT_BY_ALKACON[i]);
        }
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_LINE_0));
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_STARTUP_TIME_1, new Date(System.currentTimeMillis())));
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_OPENCMS_VERSION_1, OpenCms.getSystemInfo().getVersionNumber() + " [" + OpenCms.getSystemInfo().getVersionId() + "]"));
        if (serverInfo != null) {
            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SERVLET_CONTAINER_1, serverInfo));
        }
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_WEBAPP_NAME_1, getSystemInfo().getWebApplicationName()));
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SERVLET_PATH_1, getSystemInfo().getServletPath()));
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_OPENCMS_CONTEXT_1, getSystemInfo().getOpenCmsContext()));
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_WEBINF_PATH_1, getSystemInfo().getWebInfRfsPath()));
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_PROPERTY_FILE_1, getSystemInfo().getConfigurationFileRfsPath()));
        String logFileRfsPath = getSystemInfo().getLogFileRfsPath();
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_LOG_FILE_1, logFileRfsPath != null ? logFileRfsPath : "Managed by log4j"));
    }
    String systemEncoding = null;
    try {
        systemEncoding = System.getProperty("file.encoding");
    } catch (SecurityException se) {
        // security manager is active, but we will try other options before giving up
        LOG.debug("Security manager preventing access to file.encoding system property.", se);
    }
    try {
        Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
    } catch (Exception e) {
        CmsLog.INIT.error(e.getLocalizedMessage(), e);
    }
    if (CmsLog.INIT.isInfoEnabled()) {
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_FILE_ENCODING_1, systemEncoding));
    }
    // read server ethernet address (MAC) and init UUID generator
    String ethernetAddress = configuration.getString("server.ethernet.address", CmsStringUtil.getEthernetAddress());
    if (CmsLog.INIT.isInfoEnabled()) {
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_ETHERNET_ADDRESS_1, ethernetAddress));
    }
    CmsUUID.init(ethernetAddress);
    // set the server name
    String serverName = configuration.getString("server.name", "OpenCmsServer");
    getSystemInfo().setServerName(serverName);
    // check the installed Java SDK
    try {
        if (CmsLog.INIT.isInfoEnabled()) {
            String jdkinfo = System.getProperty("java.vm.name") + " ";
            jdkinfo += System.getProperty("java.vm.version") + " ";
            jdkinfo += System.getProperty("java.vm.info") + " ";
            jdkinfo += System.getProperty("java.vm.vendor") + " ";
            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_JAVA_VM_1, jdkinfo));
            String osinfo = System.getProperty("os.name") + " ";
            osinfo += System.getProperty("os.version") + " ";
            osinfo += System.getProperty("os.arch") + " ";
            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_OPERATING_SYSTEM_1, osinfo));
        }
    } catch (Exception e) {
        throw new CmsInitException(Messages.get().container(Messages.ERR_CRITICAL_INIT_PROP_0), e);
    }
    // create the configuration manager instance
    m_configurationManager = new CmsConfigurationManager(getSystemInfo().getConfigFolder());
    // store the configuration read from "opencms.properties" in the configuration manager
    m_configurationManager.setConfiguration(configuration);
    // now load the XML configuration
    try {
        m_configurationManager.loadXmlConfiguration();
    } catch (Exception e) {
        throw new CmsInitException(Messages.get().container(Messages.ERR_CRITICAL_INIT_XML_0), e);
    }
    // get the system configuration
    CmsSystemConfiguration systemConfiguration = (CmsSystemConfiguration) m_configurationManager.getConfiguration(CmsSystemConfiguration.class);
    if (systemConfiguration.useSaxImplSystemProperties()) {
        CmsXmlUtils.initSystemProperties();
    }
    // initialize the memory monitor
    CmsMemoryMonitorConfiguration memoryMonitorConfiguration = systemConfiguration.getCmsMemoryMonitorConfiguration();
    // initialize the memory monitor
    try {
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(memoryMonitorConfiguration.getClassName())) {
            m_memoryMonitor = (CmsMemoryMonitor) Class.forName(memoryMonitorConfiguration.getClassName()).newInstance();
        } else {
            m_memoryMonitor = new CmsMemoryMonitor();
        }
    } catch (Exception e) {
        // we can not start without a valid memory monitor
        throw new CmsInitException(Messages.get().container(Messages.ERR_CRITICAL_INIT_MEMORY_MONITOR_1, memoryMonitorConfiguration.getClassName()), e);
    }
    m_memoryMonitor.initialize(systemConfiguration);
    // get the event manager from the configuration and initialize it with the events already registered
    CmsEventManager configuredEventManager = systemConfiguration.getEventManager();
    configuredEventManager.initialize(m_eventManager);
    m_eventManager = configuredEventManager;
    // check if the encoding setting is valid
    String setEncoding = systemConfiguration.getDefaultContentEncoding();
    String defaultEncoding = CmsEncoder.lookupEncoding(setEncoding, null);
    if (defaultEncoding == null) {
        // we can not start without a valid encoding setting
        throw new CmsInitException(Messages.get().container(Messages.ERR_CRITICAL_INIT_ENCODING_1, setEncoding));
    }
    if (CmsLog.INIT.isInfoEnabled()) {
        CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_OPENCMS_ENCODING_1, defaultEncoding));
    }
    getSystemInfo().setDefaultEncoding(defaultEncoding);
    // set version history information
    getSystemInfo().setVersionHistorySettings(systemConfiguration.isHistoryEnabled(), systemConfiguration.getHistoryVersions(), systemConfiguration.getHistoryVersionsAfterDeletion());
    // set mail configuration
    getSystemInfo().setMailSettings(systemConfiguration.getMailSettings());
    // set HTTP authentication settings
    getSystemInfo().setHttpAuthenticationSettings(systemConfiguration.getHttpAuthenticationSettings());
    getSystemInfo().setRestrictDetailContents(systemConfiguration.isRestrictDetailContents());
    // set content notification settings
    getSystemInfo().setNotificationTime(systemConfiguration.getNotificationTime());
    getSystemInfo().setNotificationProject(systemConfiguration.getNotificationProject());
    m_executor = new ScheduledThreadPoolExecutor(3, new ThreadFactoryBuilder().setNameFormat("OpenCmsCore-exec-%d").build());
    // set resource init classes
    m_resourceInitHandlers = systemConfiguration.getResourceInitHandlers();
    // register request handler classes
    Iterator<I_CmsRequestHandler> it = systemConfiguration.getRequestHandlers().iterator();
    while (it.hasNext()) {
        I_CmsRequestHandler handler = it.next();
        addRequestHandler(handler);
        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_REQUEST_HANDLER_CLASS_1, handler.getClass().getName()));
        }
    }
    // read the default user configuration
    m_defaultUsers = systemConfiguration.getCmsDefaultUsers();
    // get the site manager from the configuration
    CmsSitesConfiguration sitesConfiguration = (CmsSitesConfiguration) m_configurationManager.getConfiguration(CmsSitesConfiguration.class);
    m_siteManager = sitesConfiguration.getSiteManager();
    CmsSchedulerConfiguration schedulerConfiguration = (CmsSchedulerConfiguration) m_configurationManager.getConfiguration(CmsSchedulerConfiguration.class);
    // set the scheduler manager
    m_scheduleManager = schedulerConfiguration.getScheduleManager();
    CmsVariablesConfiguration variablesConfiguration = (CmsVariablesConfiguration) m_configurationManager.getConfiguration(CmsVariablesConfiguration.class);
    // get the VFS / resource configuration
    CmsVfsConfiguration vfsConfiguation = (CmsVfsConfiguration) m_configurationManager.getConfiguration(CmsVfsConfiguration.class);
    m_resourceManager = vfsConfiguation.getResourceManager();
    m_xmlContentTypeManager = vfsConfiguation.getXmlContentTypeManager();
    m_defaultFiles = vfsConfiguation.getDefaultFiles();
    // initialize translation engines
    m_resourceManager.setTranslators(vfsConfiguation.getFolderTranslator(), vfsConfiguation.getFileTranslator(), vfsConfiguation.getXsdTranslator());
    // try to initialize the flex cache
    CmsFlexCache flexCache = null;
    try {
        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_FLEX_CACHE_STARTING_0));
        }
        // get the flex cache configuration from the SystemConfiguration
        CmsFlexCacheConfiguration flexCacheConfiguration = systemConfiguration.getCmsFlexCacheConfiguration();
        getSystemInfo().setDeviceSelector(flexCacheConfiguration.getDeviceSelector());
        // pass configuration to flex cache for initialization
        flexCache = new CmsFlexCache(flexCacheConfiguration);
        m_flexCache = flexCache;
        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_FLEX_CACHE_FINISHED_0));
        }
    } catch (Exception e) {
        if (CmsLog.INIT.isWarnEnabled()) {
            CmsLog.INIT.warn(Messages.get().getBundle().key(Messages.INIT_FLEX_CACHE_ERROR_1, e.getMessage()));
        }
    }
    if (flexCache != null) {
        // check all resource loaders if they require the Flex cache
        Iterator<I_CmsResourceLoader> i = m_resourceManager.getLoaders().iterator();
        while (i.hasNext()) {
            Object o = i.next();
            if (o instanceof I_CmsFlexCacheEnabledLoader) {
                // this resource loader requires the Flex cache
                ((I_CmsFlexCacheEnabledLoader) o).setFlexCache(flexCache);
            }
        }
    }
    // get the import/export configuration
    CmsImportExportConfiguration importExportConfiguration = (CmsImportExportConfiguration) m_configurationManager.getConfiguration(CmsImportExportConfiguration.class);
    m_importExportManager = importExportConfiguration.getImportExportManager();
    m_staticExportManager = importExportConfiguration.getStaticExportManager();
    m_repositoryManager = importExportConfiguration.getRepositoryManager();
    // get the search configuration
    CmsSearchConfiguration searchConfiguration = (CmsSearchConfiguration) m_configurationManager.getConfiguration(CmsSearchConfiguration.class);
    m_searchManager = searchConfiguration.getSearchManager();
    // get the workplace configuration
    CmsWorkplaceConfiguration workplaceConfiguration = (CmsWorkplaceConfiguration) m_configurationManager.getConfiguration(CmsWorkplaceConfiguration.class);
    m_workplaceManager = workplaceConfiguration.getWorkplaceManager();
    // add the export points from the workplace
    addExportPoints(m_workplaceManager.getExportPoints());
    addExportPoints(m_staticExportManager.getExportPoints());
    // get the module configuration
    CmsModuleConfiguration moduleConfiguration = (CmsModuleConfiguration) m_configurationManager.getConfiguration(CmsModuleConfiguration.class);
    m_moduleManager = moduleConfiguration.getModuleManager();
    // get the password handler
    m_passwordHandler = systemConfiguration.getPasswordHandler();
    // get the validation handler
    m_validationHandler = systemConfiguration.getValidationHandler();
    // get the authorization handler
    m_authorizationHandler = systemConfiguration.getAuthorizationHandler();
    // get the login manager
    m_loginManager = systemConfiguration.getLoginManager();
    // set the login message
    try {
        m_loginManager.setLoginMessage(null, variablesConfiguration.getLoginMessage());
        m_loginManager.setBeforeLoginMessage(null, variablesConfiguration.getBeforeLoginMessage());
    } catch (CmsRoleViolationException e1) {
        CmsLog.INIT.error(e1.getLocalizedMessage(), e1);
    }
    // initialize the publish engine
    m_publishEngine = new CmsPublishEngine(systemConfiguration.getRuntimeInfoFactory());
    // Credentials resolver - needs to be set before the driver manager is initialized
    m_credentialsResolver = systemConfiguration.getCredentialsResolver();
    // init the OpenCms security manager
    m_securityManager = CmsSecurityManager.newInstance(m_configurationManager, systemConfiguration.getRuntimeInfoFactory(), m_publishEngine);
    // get the publish manager
    m_publishManager = systemConfiguration.getPublishManager();
    // get the subscription manager
    m_subscriptionManager = systemConfiguration.getSubscriptionManager();
    // initialize the role manager
    m_roleManager = new CmsRoleManager(m_securityManager);
    // initialize the organizational unit manager
    m_orgUnitManager = new CmsOrgUnitManager(m_securityManager);
    // initialize the Thread store
    m_threadStore = new CmsThreadStore(m_securityManager);
    // initialize the link manager
    m_linkManager = new CmsLinkManager(m_staticExportManager.getLinkSubstitutionHandler());
    m_aliasManager = new CmsAliasManager(m_securityManager);
    // store the runtime properties
    m_runtimeProperties.putAll(systemConfiguration.getRuntimeProperties());
    // initialize the session storage provider
    I_CmsSessionStorageProvider sessionStorageProvider = systemConfiguration.getSessionStorageProvider();
    // get an Admin cms context object with site root set to "/"
    CmsObject adminCms;
    try {
        adminCms = initCmsObject(null, null, getDefaultUsers().getUserAdmin(), (String) null, (String) null);
    } catch (CmsException e) {
        throw new CmsInitException(Messages.get().container(Messages.ERR_CRITICAL_INIT_ADMINCMS_0), e);
    }
    m_configAdminCms = adminCms;
    m_repositoryManager.initializeCms(adminCms);
    // now initialize the other managers
    try {
        if (flexCache != null) {
            flexCache.initializeCms(initCmsObject(adminCms));
        }
        m_configurationManager.setAdminCms(adminCms);
        // initialize the scheduler
        m_scheduleManager.initialize(initCmsObject(adminCms));
        // initialize the locale manager
        m_localeManager = systemConfiguration.getLocaleManager();
        m_localeManager.initialize(initCmsObject(adminCms));
        // initialize the site manager
        m_siteManager.initialize(initCmsObject(adminCms));
        // initialize the static export manager
        m_staticExportManager.initialize(initCmsObject(adminCms));
        // initialize the XML content type manager
        m_xmlContentTypeManager.initialize(initCmsObject(adminCms));
        m_orgUnitManager.initialize(initCmsObject(adminCms));
        // initialize the module manager
        m_moduleManager.initialize(initCmsObject(adminCms), m_configurationManager);
        // initialize the resource manager
        m_resourceManager.initialize(initCmsObject(adminCms));
        // initialize the publish manager
        m_publishManager.setPublishEngine(m_publishEngine);
        m_publishManager.setSecurityManager(m_securityManager);
        m_publishManager.setPublishListRemoveMode(systemConfiguration.getPublishListRemoveMode());
        m_publishManager.initialize(initCmsObject(adminCms));
        // initialize the search manager
        m_searchManager.initialize(initCmsObject(adminCms));
        // initialize the VFS bundle manager
        m_vfsBundleManager = new CmsVfsBundleManager(adminCms);
        // initialize the workplace manager
        m_workplaceManager.initialize(initCmsObject(adminCms));
        // initialize the session manager
        m_sessionManager.initialize(sessionStorageProvider, initCmsObject(adminCms));
        m_sessionManager.setUserSessionMode(systemConfiguration.getUserSessionMode(true));
        // initialize the subscription manager
        m_subscriptionManager.setSecurityManager(m_securityManager);
        m_subscriptionManager.initialize(adminCms);
        CmsUgcSessionFactory.setAdminCms(adminCms);
        // initialize the formatter configuration
        CmsFormatterConfiguration.initialize(adminCms);
        CmsPersistentLoginTokenHandler.setAdminCms(initCmsObject(adminCms));
        CmsLoginUI.setAdminCmsObject(initCmsObject(adminCms));
        // initialize ade manager
        m_adeManager = new CmsADEManager(initCmsObject(adminCms), m_memoryMonitor, systemConfiguration);
        m_workplaceAppManager = new CmsWorkplaceAppManager(initCmsObject(adminCms));
        m_workplaceAppManager.loadApps();
        m_workplaceAppManager.initWorkplaceCssUris(m_moduleManager);
        m_templateContextManager = new CmsTemplateContextManager(initCmsObject(adminCms));
        m_workflowManager = systemConfiguration.getWorkflowManager();
        m_letsEncryptConfig = systemConfiguration.getLetsEncryptConfig();
        m_userDataRequestManager = systemConfiguration.getUserDataRequestManager();
        if (m_userDataRequestManager != null) {
            m_userDataRequestManager.initialize(initCmsObject(adminCms));
        }
        if (m_workflowManager == null) {
            m_workflowManager = new CmsDefaultWorkflowManager();
            m_workflowManager.setParameters(new HashMap<String, String>());
        }
        m_remoteShellServer = CmsRemoteShellServer.initialize(systemConfiguration);
        CmsPublishScheduledDialog.setAdminCms(initCmsObject(adminCms));
        m_workflowManager.initialize(initCmsObject(adminCms));
        m_apiAuthorizations = systemConfiguration.getApiAuthorizations();
        for (I_CmsApiAuthorizationHandler apiAuthorization : m_apiAuthorizations.values()) {
            apiAuthorization.initialize(initCmsObject(adminCms));
        }
        for (I_CmsResourceInit resourceInit : m_resourceInitHandlers) {
            if (resourceInit instanceof I_CmsNeedsAdminCmsObject) {
                ((I_CmsNeedsAdminCmsObject) resourceInit).setAdminCmsObject(adminCms);
            }
        }
        for (I_CmsRequestHandler requestHandler : m_requestHandlers.values()) {
            if (requestHandler instanceof I_CmsNeedsAdminCmsObject) {
                ((I_CmsNeedsAdminCmsObject) requestHandler).setAdminCmsObject(adminCms);
            }
        }
        m_textEncryptions = new LinkedHashMap<>();
        for (I_CmsTextEncryption encryption : systemConfiguration.getTextEncryptions().values()) {
            encryption.initialize(OpenCms.initCmsObject(adminCms));
            m_textEncryptions.put(encryption.getName(), encryption);
        }
    } catch (CmsException e) {
        throw new CmsInitException(Messages.get().container(Messages.ERR_CRITICAL_INIT_MANAGERS_0), e);
    }
    try {
        // mitigate potential stringtemplate 3 class loading deadlock by making sure the class is loaded on startup
        @SuppressWarnings("unused") StringTemplate stringTemplate = new org.antlr.stringtemplate.StringTemplate();
    } catch (Exception e) {
        CmsLog.INIT.error("Problem with initializing stringtemplate class: " + e.getLocalizedMessage(), e);
    }
    try {
        getEventManager().fireEvent(I_CmsEventListener.EVENT_CLEAR_CACHES);
    } catch (Exception e) {
        CmsLog.INIT.error("Problem with clearing caches after initialization: " + e.getLocalizedMessage(), e);
    }
    CmsTaskWatcher.initialize();
}
Also used : CmsAliasManager(org.opencms.db.CmsAliasManager) CmsADEManager(org.opencms.ade.configuration.CmsADEManager) I_CmsApiAuthorizationHandler(org.opencms.xml.xml2json.I_CmsApiAuthorizationHandler) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) CmsVariablesConfiguration(org.opencms.configuration.CmsVariablesConfiguration) StringTemplate(org.antlr.stringtemplate.StringTemplate) CmsWorkplaceConfiguration(org.opencms.configuration.CmsWorkplaceConfiguration) CmsMemoryMonitorConfiguration(org.opencms.monitor.CmsMemoryMonitorConfiguration) CmsRoleManager(org.opencms.security.CmsRoleManager) CmsTemplateContextManager(org.opencms.loader.CmsTemplateContextManager) CmsSystemConfiguration(org.opencms.configuration.CmsSystemConfiguration) CmsFlexCacheConfiguration(org.opencms.flex.CmsFlexCacheConfiguration) CmsVfsBundleManager(org.opencms.i18n.CmsVfsBundleManager) CmsConfigurationManager(org.opencms.configuration.CmsConfigurationManager) CmsPublishEngine(org.opencms.publish.CmsPublishEngine) I_CmsResourceLoader(org.opencms.loader.I_CmsResourceLoader) CmsMemoryMonitor(org.opencms.monitor.CmsMemoryMonitor) CmsRoleViolationException(org.opencms.security.CmsRoleViolationException) CmsObject(org.opencms.file.CmsObject) I_CmsNeedsAdminCmsObject(org.opencms.configuration.I_CmsNeedsAdminCmsObject) JSONObject(org.opencms.json.JSONObject) CmsModuleConfiguration(org.opencms.configuration.CmsModuleConfiguration) CmsDefaultWorkflowManager(org.opencms.workflow.CmsDefaultWorkflowManager) I_CmsTextEncryption(org.opencms.crypto.I_CmsTextEncryption) CmsSitesConfiguration(org.opencms.configuration.CmsSitesConfiguration) CmsImportExportConfiguration(org.opencms.configuration.CmsImportExportConfiguration) CmsLinkManager(org.opencms.staticexport.CmsLinkManager) CmsWorkplaceAppManager(org.opencms.ui.apps.CmsWorkplaceAppManager) CmsObject(org.opencms.file.CmsObject) I_CmsNeedsAdminCmsObject(org.opencms.configuration.I_CmsNeedsAdminCmsObject) CmsVfsConfiguration(org.opencms.configuration.CmsVfsConfiguration) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) CmsSchedulerConfiguration(org.opencms.configuration.CmsSchedulerConfiguration) CmsSecurityException(org.opencms.security.CmsSecurityException) CmsFlexCache(org.opencms.flex.CmsFlexCache) I_CmsNeedsAdminCmsObject(org.opencms.configuration.I_CmsNeedsAdminCmsObject) CmsExportPoint(org.opencms.db.CmsExportPoint) Date(java.util.Date) CmsRoleViolationException(org.opencms.security.CmsRoleViolationException) CmsConfigurationException(org.opencms.configuration.CmsConfigurationException) CmsDbEntryNotFoundException(org.opencms.db.CmsDbEntryNotFoundException) CmsSecurityException(org.opencms.security.CmsSecurityException) CmsVfsResourceNotFoundException(org.opencms.file.CmsVfsResourceNotFoundException) IOException(java.io.IOException) ServletException(javax.servlet.ServletException) CmsOrgUnitManager(org.opencms.security.CmsOrgUnitManager) I_CmsFlexCacheEnabledLoader(org.opencms.loader.I_CmsFlexCacheEnabledLoader) CmsSearchConfiguration(org.opencms.configuration.CmsSearchConfiguration)

Example 5 with CmsFlexCache

use of org.opencms.flex.CmsFlexCache in project opencms-core by alkacon.

the class CmsFlexCacheList method getListItems.

/**
 * @see org.opencms.workplace.list.A_CmsListDialog#getListItems()
 */
@Override
protected List getListItems() {
    List ret = new ArrayList();
    CmsFlexController controller = (CmsFlexController) getJsp().getRequest().getAttribute(CmsFlexController.ATTRIBUTE_NAME);
    CmsFlexCache cache = controller.getCmsCache();
    // get content
    Iterator itResources = new ArrayList(cache.getCachedResources(getCms())).iterator();
    while (itResources.hasNext()) {
        String resource = (String) itResources.next();
        CmsListItem item = getList().newItem(resource);
        String resName = resource;
        String project = "";
        if (resource.endsWith(CmsFlexCache.CACHE_OFFLINESUFFIX)) {
            resName = resource.substring(0, resource.length() - CmsFlexCache.CACHE_OFFLINESUFFIX.length());
            project = "Offline";
        }
        if (resource.endsWith(CmsFlexCache.CACHE_ONLINESUFFIX)) {
            resName = resource.substring(0, resource.length() - CmsFlexCache.CACHE_ONLINESUFFIX.length());
            project = "Online";
        }
        item.set(LIST_COLUMN_RESOURCE, resName);
        item.set(LIST_COLUMN_PROJECT, project);
        item.set(LIST_COLUMN_KEY, cache.getCachedKey(resource, getCms()));
        ret.add(item);
    }
    return ret;
}
Also used : CmsListItem(org.opencms.workplace.list.CmsListItem) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) CmsFlexController(org.opencms.flex.CmsFlexController) ArrayList(java.util.ArrayList) List(java.util.List) CmsFlexCache(org.opencms.flex.CmsFlexCache)

Aggregations

CmsFlexCache (org.opencms.flex.CmsFlexCache)7 CmsFlexController (org.opencms.flex.CmsFlexController)5 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 List (java.util.List)2 CmsLruCache (org.opencms.cache.CmsLruCache)2 CmsObject (org.opencms.file.CmsObject)2 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 Label (com.vaadin.v7.ui.Label)1 VerticalLayout (com.vaadin.v7.ui.VerticalLayout)1 IOException (java.io.IOException)1 Date (java.util.Date)1 LinkedHashMap (java.util.LinkedHashMap)1 Locale (java.util.Locale)1 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1 ServletException (javax.servlet.ServletException)1 StringTemplate (org.antlr.stringtemplate.StringTemplate)1 CmsADEManager (org.opencms.ade.configuration.CmsADEManager)1 CmsConfigurationException (org.opencms.configuration.CmsConfigurationException)1 CmsConfigurationManager (org.opencms.configuration.CmsConfigurationManager)1