
org.nakedobjects.runtime.session.NakedObjectSessionFactoryAbstract Maven / Gradle / Ivy
package org.nakedobjects.runtime.session;
import java.util.List;
import org.nakedobjects.metamodel.authentication.AuthenticationSession;
import org.nakedobjects.metamodel.commons.component.ApplicationScopedComponent;
import org.nakedobjects.metamodel.config.NakedObjectConfiguration;
import org.nakedobjects.metamodel.specloader.SpecificationLoader;
import org.nakedobjects.runtime.authentication.AuthenticationManager;
import org.nakedobjects.runtime.imageloader.TemplateImageLoader;
import org.nakedobjects.runtime.installers.InstallerLookup;
import org.nakedobjects.runtime.persistence.PersistenceSession;
import org.nakedobjects.runtime.persistence.PersistenceSessionFactory;
import org.nakedobjects.runtime.system.DeploymentType;
import org.nakedobjects.runtime.userprofile.UserProfile;
import org.nakedobjects.runtime.userprofile.UserProfileLoader;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.nakedobjects.metamodel.commons.ensure.Ensure.ensureThatArg;
/**
* Creates an implementation of {@link NakedObjectSessionFactory#openSession(AuthenticationSession)} to create
* an {@link NakedObjectSession}, but delegates to subclasses to actually obtain the components that make up
* that {@link NakedObjectSession}.
*
*
* The idea is that one subclass can use the {@link InstallerLookup} design to lookup installers for
* components (and hence create the components themselves), whereas another subclass might simply use Spring
* (or another DI container) to inject in the components according to some Spring-configured application
* context.
*/
public abstract class NakedObjectSessionFactoryAbstract implements NakedObjectSessionFactory {
private final DeploymentType deploymentType;
private final NakedObjectConfiguration configuration;
private final TemplateImageLoader templateImageLoader;
private final SpecificationLoader specificationLoader;
private final AuthenticationManager authenticationManager;
private final PersistenceSessionFactory persistenceSessionFactory;
private final UserProfileLoader userProfileLoader;
private final List