Search in sources :

Example 1 with StoreProperties

use of org.glassfish.web.deployment.runtime.StoreProperties 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)

Example 2 with StoreProperties

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

the class SessionManagerConfigurationHelper method getPersistenceScope.

/**
 * Get the persistence scope for this web module
 * (this is the value from sun-web.xml if defined
 * @param smBean the session manager config bean
 */
protected String getPersistenceScope(SessionManager smBean) {
    String persistenceScope = null;
    StoreProperties storeBean = smBean.getStoreProperties();
    if ((storeBean != null) && (storeBean.sizeWebProperty() > 0)) {
        WebProperty[] props = storeBean.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("persistenceScope")) {
                persistenceScope = value;
            }
        }
    }
    return persistenceScope;
}
Also used : WebProperty(org.glassfish.web.deployment.runtime.WebProperty) StoreProperties(org.glassfish.web.deployment.runtime.StoreProperties)

Aggregations

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