/*
 *   Copyright 2011 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;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import net.brutex.xservices.types.TargetNodeType;
import net.brutex.xservices.types.ant.AttachmentType;
import net.brutex.xservices.types.ant.CollectionType;
import net.brutex.xservices.util.BrutexNamespaces;

import org.apache.cxf.annotations.WSDLDocumentation;

/**
 * Storage management services.
 * @author Brian Rosenberger
 * @since 0.5.0
 *
 */
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
public interface StorageService {
	
	public static final String SERVICE_NAME = "StorageService";
	
	final String OPERATION_STORETEXT = "storeText";
	final String OPERATION_STOREBINARY = "storeBinary";
	final String OPERATION_CREATECOLLECTION = "createCollection";
	final String OPERATION_DELIVERCOLLECTION = "deliverCollection";
	
	final String PARAM_TEXT = "text";
	final String PARAM_BINARY = "binary";
	final String PARAM_NAME = "name";
	final String PARAM_COLLECTION = "collection";
	final String PARAM_TARGETNODE = "target";
	final String PARAM_RAISEEVENT = "event";
		;
	/**
	 * Store text based data.
	 * @param text text to be stored
	 * 
	 * @return uuid reference to stored object
	 * @throws XServicesFault
	 */
	@WebMethod(operationName=OPERATION_STORETEXT)
	@WSDLDocumentation(value="Store text based data")
	public abstract String storeText(@WebParam(name = PARAM_TEXT) String text) throws XServicesFault;
	
	@WebMethod(operationName=OPERATION_STOREBINARY)
	@WSDLDocumentation(value="Store binary data")
	public abstract String storeBinary(
				@WebParam(name= PARAM_BINARY) AttachmentType binary)
				throws XServicesFault;
	
	@WebMethod(operationName=OPERATION_CREATECOLLECTION)
	@WSDLDocumentation(value="Create a new Collection by name.")
	public abstract String createCollection(
				@WebParam(name= PARAM_COLLECTION) CollectionType collection)
				throws XServicesFault;
	
	@WebMethod(operationName=OPERATION_DELIVERCOLLECTION)
	@WSDLDocumentation(value="Deliver a collection to a target node (asynchronous).")
	public abstract void deliverCollection(
				@WebParam(name= PARAM_COLLECTION) CollectionType collection,
				@WebParam(name= PARAM_TARGETNODE) TargetNodeType targetnode,
				@WebParam(name= PARAM_RAISEEVENT) boolean isFiring)
				throws XServicesFault;
	
	
}
