All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.protobuf.pro.stream.server.PushHandler Maven / Gradle / Ivy

Go to download

Protobuf Streamer Pro is a java protocol buffers is a google protocol buffers transport for large streamed messages featuring multiplexed sending over reused TCP connections.

There is a newer version: 1.2.3
Show newest version
/**
 *   Copyright 2010 Peter Klauser
 *
 *   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.googlecode.protobuf.pro.stream.server;

import com.google.protobuf.Message;
import com.googlecode.protobuf.pro.stream.PushIn;
import com.googlecode.protobuf.pro.stream.TransferIn;

/**
 * @author Peter Klauser
 *
 */
public interface PushHandler {

	public E getPrototype();
	
	/**
	 * The initial Push message is received before any data chunks
	 * The PushHandler has the opportunity to initialize data structures
	 * to handle the Push and get ready for {@link #data(Message, TransferIn)}
	 * to be called for each received chunk.
	 * 
	 * The transferIn will not have any data available.
	 * 
	 * @param message
	 */
	public void init( E message, PushIn transferIn );
	
	/**
	 * New chunk data is available in TransferIn.
	 * 
	 * Once transfer from client to server is finished, the server
	 * {@link TransferIn#isOpen()} will return false. The method will
	 * never be called again once the TransferIn returns false.
	 *  
	 * 
	 * @param message
	 * @param transferIn
	 */
	public void data( E message, PushIn transferIn );
	
	/**
	 * Cleanup and perform transfer end processing once transfer has ended.
	 * 
	 * The success or failure of the transfer is not considered here
	 * this must be determined by data integrity information transferred
	 * with the TODO tranferIn properties
	 *  
	 * The transferIn will be closed on entry.
	 * 
	 * @param message
	 * @param transferIn
	 */
	public void end( E message, PushIn transferIn );
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy