InstanceSessionFactory.java

/***************************************************************************
   Copyright 2014 Emily Estes

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
***************************************************************************/
package net.metanotion.web.concrete;


import net.metanotion.util.Unknown;
import net.metanotion.web.Instance;
import net.metanotion.web.RequestObject;
import net.metanotion.web.SessionFactory;

/** This class is an adapter to convert an {@link net.metanotion.web.Instance} into a
{@link net.metanotion.web.SessionFactory}. */
public final class InstanceSessionFactory implements SessionFactory<RequestObject> {
	private final Instance app;
	/** Create a new session factory backed by the instance implementation.
		@param app The instance to create sessions.
	*/
	public InstanceSessionFactory(final Instance app) { this.app = app; }
	@Override public Unknown newSession(final RequestObject ro) { return app.newSession(); }
}