// Path: echo/src/main/java/org/restexpress/example/echo/controller/EchoController.java
// public class EchoController
// extends AbstractDelayingController
// {
//     private static final String ECHO_PARAMETER_NOT_FOUND = "'echo' header or query-string parameter not found";
// 	private static final String ECHO_HEADER = "echo";
// 
// 	public ByteBuf create(Request request, Response response)
// 	{
// 		delay(request);
// 		response.setResponseCreated();
// 		return request.getBody();
// 	}
// 	
// 	public String delete(Request request, Response response)
// 	{
// 		delay(request);
// 		return request.getHeader(ECHO_HEADER, ECHO_PARAMETER_NOT_FOUND);
// 	}
// 	
// 	public String read(Request request, Response response)
// 	{
// 		System.out.println(request.getRemoteAddress());
// 		delay(request);
// 		String echo = request.getHeader(ECHO_HEADER);
// 		
// 		if (echo == null)
// 		{
// 			return "Please set query-string parameter 'echo' (e.g. ?echo=value)";
// 		}
// 		
// 		return echo;
// 	}
// 
// 	public ByteBuf update(Request request, Response response)
// 	{
// 		delay(request);
// 		return request.getBody();
// 	}
// }
// 
// Path: echo/src/main/java/org/restexpress/example/echo/controller/StatusController.java
// public class StatusController
// extends AbstractDelayingController
// {
// 	private static final String STATUS_RESPONSE_HEADER = "http_response_code";
// 
// 	public Object create(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		int status = Integer.valueOf(request.getHeader(STATUS_RESPONSE_HEADER));
// 		response.setResponseCode(status);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("create", delayms, message);
// 	}
// 
// 	public Object read(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		int status = Integer.valueOf(request.getHeader(STATUS_RESPONSE_HEADER));
// 		response.setResponseCode(status);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("read", delayms, message);
// 	}
// 
// 	public Object update(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		int status = Integer.valueOf(request.getHeader(STATUS_RESPONSE_HEADER));
// 		response.setResponseCode(status);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("update", delayms, message);
// 	}
// 
// 	public Object delete(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		int status = Integer.valueOf(request.getHeader(STATUS_RESPONSE_HEADER));
// 		response.setResponseCode(status);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("delete", delayms, message);
// 	}
// }
// 
// Path: echo/src/main/java/org/restexpress/example/echo/controller/SuccessController.java
// public class SuccessController
// extends AbstractDelayingController
// {
// 	public Object create(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		response.setResponseCreated();
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("create", delayms, message);
// 	}
// 
// 	public Object read(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("read", delayms, message);
// 	}
// 
// 	public Object update(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("update", delayms, message);
// 	}
// 
// 	public Object delete(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("delete", delayms, message);
// 	}
// }


import java.util.Properties;
import org.restexpress.Format;
import org.restexpress.RestExpress;
import org.restexpress.example.echo.controller.EchoController;
import org.restexpress.example.echo.controller.StatusController;
import org.restexpress.example.echo.controller.SuccessController;
import org.restexpress.util.Environment;
/*
    Copyright 2011, Strategic Gains, Inc.

	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 org.restexpress.example.echo;



/**
 * @author toddf
 * @since Feb 10, 2011
 */
public class Configuration
extends Environment
{
	private static final String NAME_PROPERTY = "name";
	private static final String PORT_PROPERTY = "port";
	private static final String DEFAULT_FORMAT_PROPERTY = "defaultFormat";
	private static final String WORKER_COUNT_PROPERTY = "workerCount";
	private static final String EXECUTOR_THREAD_COUNT_PROPERTY = "executorThreadCount";

	private static final int DEFAULT_WORKER_COUNT = 0;
	private static final int DEFAULT_EXECUTOR_THREAD_COUNT = 0;

	private int port;
	private String name;
	private String defaultFormat;
	private int workerCount;
	private int executorThreadCount;
	
	private EchoController echoController = new EchoController();
// Path: echo/src/main/java/org/restexpress/example/echo/controller/EchoController.java
// public class EchoController
// extends AbstractDelayingController
// {
//     private static final String ECHO_PARAMETER_NOT_FOUND = "'echo' header or query-string parameter not found";
// 	private static final String ECHO_HEADER = "echo";
// 
// 	public ByteBuf create(Request request, Response response)
// 	{
// 		delay(request);
// 		response.setResponseCreated();
// 		return request.getBody();
// 	}
// 	
// 	public String delete(Request request, Response response)
// 	{
// 		delay(request);
// 		return request.getHeader(ECHO_HEADER, ECHO_PARAMETER_NOT_FOUND);
// 	}
// 	
// 	public String read(Request request, Response response)
// 	{
// 		System.out.println(request.getRemoteAddress());
// 		delay(request);
// 		String echo = request.getHeader(ECHO_HEADER);
// 		
// 		if (echo == null)
// 		{
// 			return "Please set query-string parameter 'echo' (e.g. ?echo=value)";
// 		}
// 		
// 		return echo;
// 	}
// 
// 	public ByteBuf update(Request request, Response response)
// 	{
// 		delay(request);
// 		return request.getBody();
// 	}
// }
// 
// Path: echo/src/main/java/org/restexpress/example/echo/controller/StatusController.java
// public class StatusController
// extends AbstractDelayingController
// {
// 	private static final String STATUS_RESPONSE_HEADER = "http_response_code";
// 
// 	public Object create(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		int status = Integer.valueOf(request.getHeader(STATUS_RESPONSE_HEADER));
// 		response.setResponseCode(status);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("create", delayms, message);
// 	}
// 
// 	public Object read(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		int status = Integer.valueOf(request.getHeader(STATUS_RESPONSE_HEADER));
// 		response.setResponseCode(status);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("read", delayms, message);
// 	}
// 
// 	public Object update(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		int status = Integer.valueOf(request.getHeader(STATUS_RESPONSE_HEADER));
// 		response.setResponseCode(status);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("update", delayms, message);
// 	}
// 
// 	public Object delete(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		int status = Integer.valueOf(request.getHeader(STATUS_RESPONSE_HEADER));
// 		response.setResponseCode(status);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("delete", delayms, message);
// 	}
// }
// 
// Path: echo/src/main/java/org/restexpress/example/echo/controller/SuccessController.java
// public class SuccessController
// extends AbstractDelayingController
// {
// 	public Object create(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		response.setResponseCreated();
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("create", delayms, message);
// 	}
// 
// 	public Object read(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("read", delayms, message);
// 	}
// 
// 	public Object update(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("update", delayms, message);
// 	}
// 
// 	public Object delete(Request request, Response response)
// 	{
// 		long delayms = delay(request);
// 		String message = request.getHeader("echo");
// 		return new DelayResponse("delete", delayms, message);
// 	}
// }


// Path: echo/src/main/java/org/restexpress/example/echo/Configuration.java
import java.util.Properties;
import org.restexpress.Format;
import org.restexpress.RestExpress;
import org.restexpress.example.echo.controller.EchoController;
import org.restexpress.example.echo.controller.StatusController;
import org.restexpress.example.echo.controller.SuccessController;
import org.restexpress.util.Environment;

/*
    Copyright 2011, Strategic Gains, Inc.

	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 org.restexpress.example.echo;



/**
 * @author toddf
 * @since Feb 10, 2011
 */
public class Configuration
extends Environment
{
	private static final String NAME_PROPERTY = "name";
	private static final String PORT_PROPERTY = "port";
	private static final String DEFAULT_FORMAT_PROPERTY = "defaultFormat";
	private static final String WORKER_COUNT_PROPERTY = "workerCount";
	private static final String EXECUTOR_THREAD_COUNT_PROPERTY = "executorThreadCount";

	private static final int DEFAULT_WORKER_COUNT = 0;
	private static final int DEFAULT_EXECUTOR_THREAD_COUNT = 0;

	private int port;
	private String name;
	private String defaultFormat;
	private int workerCount;
	private int executorThreadCount;
	
	private EchoController echoController = new EchoController();
	private SuccessController successController = new SuccessController();