/*
 *   Copyright 2014 Brian Rosenberger (Brutex Network)
 *
 *   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.brutex.xservices.ws.rs;

import java.io.File;

import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;

import org.apache.commons.jcs.access.exception.CacheException;

import net.brutex.xservices.ws.XServicesFault;


/**
 * The Dim CM Browsing Rest Service.
 * 
 * @author Brian Rosenberger, bru(at)brutex.de
 */

@Path("/")
@Produces({ "text/xml" })
public abstract interface DIMCMInfo {

	public final static String BASE_PATH = "/DIMCMService/";
	public final static String SERVICE_NAME = "DIMCMInfoService";
	
	/**
	 * Get the file/ directory listing.
	 *
	 * @param paramHttpHeaders the param http headers
	 * @param uriInfo request url info
	 * @param directory The directory to list.
	 * @param includeDirectories Whether or not to include directories in the listing. Default is true.
	 * @param includeFiles Whether or not to include files in the listing. Default is true.
	 * @param depth Include subdirectories down to a given depth. Default is 1.
	 * @param search Additional "Glob search pattern" for the file/ directory name. I.e. '*.log'
	 * @param itemsPerPage How many items to return with one call. Default is 50.
	 * @param page Paging support. Default is 1.
	 * @param useCache whether or not to use cache. Defaults to true.
	 * @return the FileInfo Set as an XML structure
	 * @throws CacheException 
	 */
	@GET
	@Path("getItems/")
	public abstract Response getFiles(
			@Context HttpHeaders paramHttpHeaders,
			@Context UriInfo uriInfo,
			@QueryParam("projSpec") String project,
			@QueryParam("directory") String directory,
			@QueryParam("recursive") @DefaultValue("false") boolean recursive,
			@QueryParam("includeFiles") @DefaultValue("1") boolean includeFiles,
			@QueryParam("depth") @DefaultValue("1") int depth,
			@QueryParam("search") String search,
			@QueryParam("itemsPerPage") @DefaultValue("50") int itemsPerPage,
			@QueryParam("page") @DefaultValue("1") int page,
			@QueryParam("usecache") @DefaultValue("true") boolean useCache) throws CacheException;

}
