All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wildfly.clustering.session.cache.CompositeImmutableSessionFactory Maven / Gradle / Ivy

There is a newer version: 4.0.0.Final
Show newest version
/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package org.wildfly.clustering.session.cache;

import java.util.Map;

import org.wildfly.clustering.cache.CacheProperties;
import org.wildfly.clustering.session.ImmutableSession;
import org.wildfly.clustering.session.ImmutableSessionMetaData;
import org.wildfly.clustering.session.cache.attributes.ImmutableSessionAttributesFactory;
import org.wildfly.clustering.session.cache.metadata.ImmutableSessionMetaDataFactory;

/**
 * Generic immutable session factory implementation - independent of cache mapping strategy.
 * @author Paul Ferraro
 * @param  the session metadata type
 * @param  the session attributes type
 */
public class CompositeImmutableSessionFactory implements ImmutableSessionFactory {
	private final ImmutableSessionMetaDataFactory metaDataFactory;
	private final ImmutableSessionAttributesFactory attributesFactory;
	private final CacheProperties properties;

	public CompositeImmutableSessionFactory(ImmutableSessionMetaDataFactory metaDataFactory, ImmutableSessionAttributesFactory attributesFactory, CacheProperties properties) {
		this.metaDataFactory = metaDataFactory;
		this.attributesFactory = attributesFactory;
		this.properties = properties;
	}

	@Override
	public ImmutableSessionMetaDataFactory getMetaDataFactory() {
		return this.metaDataFactory;
	}

	@Override
	public ImmutableSessionAttributesFactory getAttributesFactory() {
		return this.attributesFactory;
	}

	@Override
	public ImmutableSession createImmutableSession(String id, ImmutableSessionMetaData metaData, Map attributes) {
		return new CompositeImmutableSession(id, metaData, attributes);
	}

	@Override
	public CacheProperties getCacheProperties() {
		return this.properties;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy