/* 
 * Qlue Web Application Framework
 * Copyright 2009-2012 Ivan Ristic <ivanr@webkreator.com>
 *
 * 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 com.webkreator.qlue;

import java.io.PrintWriter;
import java.io.Serializable;
import java.util.Locale;

import com.webkreator.qlue.util.BearerToken;

/**
 * Represents a user session. This class implements the basics needed by the
 * framework, but applications will typically inherit it to add additional
 * functionality.
 */
public class QlueSession implements Serializable {

	private static final long serialVersionUID = -6165030155311291224L;

	private Locale locale = Locale.ENGLISH;

	private BearerToken sessionSecret = new BearerToken();

	private Integer developmentMode = null;

	/**
	 * Retrieve session development mode.
	 */
	public Integer getDevelopmentMode() {
		return developmentMode;
	}

	/**
	 * Set session development mode.
	 * 
	 * @param developmentMode
	 */
	public void setDevelopmentMode(Integer developmentMode) {
		if ((developmentMode != QlueConstants.DEVMODE_DISABLED)
				&& (developmentMode != QlueConstants.DEVMODE_ENABLED)
				&& (developmentMode != QlueConstants.DEVMODE_ONDEMAND)) {
			throw new RuntimeException(
					"Qlue: Invalid development mode setting: "
							+ developmentMode);
		}

		this.developmentMode = developmentMode;
	}

	public void writeDevelopmentInformation(PrintWriter out) {
		out.println(" Session secret (not masked): "
				+ sessionSecret.getUnmaskedToken());
		out.println(" Development mode: " + developmentMode);
	}

	public Locale getLocale() {
		return locale;
	}
	
	public BearerToken getSessionSecret() {
		return sessionSecret;
	}
}

@@ -695,24 +695,72 @@
 or.qlue;%0D%0A%0D%0A
+import com.webkreator.qlue.util.BearerToken;%0D%0A%0D%0A
 import java.
@@ -776,16 +776,16 @@
 riter;%0D%0A
-
 import j
@@ -838,56 +838,8 @@
 %0D%0A%0D%0A
-import com.webkreator.qlue.util.BearerToken;%0D%0A%0D%0A
 /**%0D
@@ -1460,42 +1460,8 @@
 e.%0D%0A
-%09 * %0D%0A%09 * @param developmentMode%0D%0A
 %09 */
@@ -1699,17 +1699,20 @@
 DEMAND))
- 
+%0D%0A%09%09
 %7B%0D%0A%09%09%09th
@@ -1736,23 +1736,16 @@
 ception(
-%0D%0A%09%09%09%09%09
 %22Qlue: I
@@ -1782,17 +1782,9 @@
 g: %22
-%0D%0A%09%09%09%09%09%09%09
+ 
 + de
@@ -1963,22 +1963,17 @@
 sked): %22
-%0D%0A%09%09%09%09
+ 
 + sessio

Tidy up.