Search in sources :

Example 1 with ManagerProperties

use of org.glassfish.web.deployment.runtime.ManagerProperties in project Payara by payara.

the class SessionManagerConfigurationHelper method getPersistenceFrequency.

/**
 * Get the persistence frequency for this web module
 * (this is the value from sun-web.xml if defined
 * @param smBean the session manager config bean
 */
protected String getPersistenceFrequency(SessionManager smBean) {
    String persistenceFrequency = null;
    ManagerProperties mgrBean = smBean.getManagerProperties();
    if ((mgrBean != null) && (mgrBean.sizeWebProperty() > 0)) {
        WebProperty[] props = mgrBean.getWebProperty();
        for (int i = 0; i < props.length; i++) {
            String name = props[i].getAttributeValue(WebProperty.NAME);
            String value = props[i].getAttributeValue(WebProperty.VALUE);
            if (name.equalsIgnoreCase("persistenceFrequency")) {
                persistenceFrequency = value;
            }
        }
    }
    return persistenceFrequency;
}
Also used : ManagerProperties(org.glassfish.web.deployment.runtime.ManagerProperties) WebProperty(org.glassfish.web.deployment.runtime.WebProperty)

Example 2 with ManagerProperties

use of org.glassfish.web.deployment.runtime.ManagerProperties in project Payara by payara.

the class BasePersistenceStrategyBuilder method readWebAppParams.

public void readWebAppParams(Context ctx, SessionManager smBean) {
    if (smBean != null) {
        // The persistence-type controls what properties of the
        // session manager can be configured
        ManagerProperties mgrBean = smBean.getManagerProperties();
        if ((mgrBean != null) && (mgrBean.sizeWebProperty() > 0)) {
            for (WebProperty prop : mgrBean.getWebProperty()) {
                String name = prop.getAttributeValue(WebProperty.NAME);
                String value = prop.getAttributeValue(WebProperty.VALUE);
                if (name.equalsIgnoreCase("reapIntervalSeconds")) {
                    try {
                        reapInterval = Integer.parseInt(value);
                    } catch (NumberFormatException e) {
                    // XXX need error message
                    }
                } else if (name.equalsIgnoreCase("maxSessions")) {
                    try {
                        maxSessions = Integer.parseInt(value);
                    } catch (NumberFormatException e) {
                    // XXX need error message
                    }
                } else /*else if (name.equalsIgnoreCase("maxIdleBackupSeconds")) {
                        try {
                            maxIdleBackup = Integer.parseInt(value);
                        } catch (NumberFormatException e) {
                            // XXX need error message
                        }                        
                    } */
                if (name.equalsIgnoreCase("relaxCacheVersionSemantics")) {
                    relaxCacheVersionSemantics = Boolean.parseBoolean(value);
                } else if (name.equalsIgnoreCase("sessionFilename")) {
                    sessionFilename = value;
                } else if (name.equalsIgnoreCase("persistenceFrequency")) {
                    _persistenceFrequency = value;
                } else {
                    if (_logger.isLoggable(Level.INFO)) {
                        Object[] params = { name };
                        _logger.log(Level.INFO, LogFacade.PROPERTY_NOT_YET_SUPPORTED, params);
                    }
                }
            }
        }
        StoreProperties storeBean = smBean.getStoreProperties();
        if ((storeBean != null) && (storeBean.sizeWebProperty() > 0)) {
            for (WebProperty prop : storeBean.getWebProperty()) {
                String name = prop.getAttributeValue(WebProperty.NAME);
                String value = prop.getAttributeValue(WebProperty.VALUE);
                if (name.equalsIgnoreCase("reapIntervalSeconds")) {
                    try {
                        storeReapInterval = Integer.parseInt(value);
                    } catch (NumberFormatException e) {
                    // XXX need error message
                    }
                } else if (name.equalsIgnoreCase("directory")) {
                    directory = value;
                } else if (name.equalsIgnoreCase("persistenceScope")) {
                    _persistenceScope = value;
                } else if (name.equalsIgnoreCase("cookieName")) {
                    persistentCookieName = value;
                } else {
                    if (_logger.isLoggable(Level.INFO)) {
                        Object[] params = { name };
                        _logger.log(Level.INFO, LogFacade.PROPERTY_NOT_YET_SUPPORTED, params);
                    }
                }
            }
        }
    }
}
Also used : ManagerProperties(org.glassfish.web.deployment.runtime.ManagerProperties) WebProperty(org.glassfish.web.deployment.runtime.WebProperty) StoreProperties(org.glassfish.web.deployment.runtime.StoreProperties)

Aggregations

ManagerProperties (org.glassfish.web.deployment.runtime.ManagerProperties)2 WebProperty (org.glassfish.web.deployment.runtime.WebProperty)2 StoreProperties (org.glassfish.web.deployment.runtime.StoreProperties)1