// Path: src/org/gearman/core/GearmanCallbackHandler.java
// public interface GearmanCallbackHandler<D,R extends GearmanCallbackResult> {
// 	public void onComplete(D data, R result);
// }
// 
// Path: src/org/gearman/core/GearmanCallbackResult.java
// public interface GearmanCallbackResult {
// 	
// 	/**
// 	 * Tests if the operation completed successfully
// 	 * @return
// 	 * 		<code>true</code> if and only if the operation was successful
// 	 */
// 	public boolean isSuccessful();
// }
// 
// Path: src/org/gearman/core/GearmanCodec.java
// public interface GearmanCodec<X> {
// 	public void init(GearmanCodecChannel<X> channel);
// 	public ByteBuffer createByteBuffer();
// 	public void decode(GearmanCodecChannel<X> channel, int byteCount);
// 	public byte[] encode(GearmanPacket packet);
// }
// 
// Path: src/org/gearman/core/GearmanConnectionHandler.java
// public interface GearmanConnectionHandler<X> {
// 	public void onAccept(GearmanConnection<X> conn);
// 	public void onPacketReceived(GearmanPacket packet, GearmanConnection<X> conn);
// 	public void onDisconnect(GearmanConnection<X> conn);
// }


import java.io.IOException;
import java.util.Set;
import org.gearman.core.GearmanCallbackHandler;
import org.gearman.core.GearmanCallbackResult;
import org.gearman.core.GearmanCodec;
import org.gearman.core.GearmanConnectionHandler;
package org.gearman;



public interface GearmanServer extends GearmanService {
	
	public static enum ConnectCallbackResult implements GearmanCallbackResult{
		SERVER_SHUTDOWN;

		@Override
		public boolean isSuccessful() {
			return false;
		}
	}
	
	/**
	 * Attempts to open the default port to listen on
	 * @throws IOException
	 * 		thrown if opening the port fails
	 */
	public void openPort() throws IOException;
	
	/**
	 * Attempts to open and listen on a given port.
	 * @param port
	 * 		The port to open
	 * @throws IOException
	 * 		thrown if opening the port fails
	 */
	public void openPort(final int port) throws IOException;
	
	/**
	 * Attempts to open and listen on a given port.<br>
	 * <br>
	 * Allows the user specifies the GearmanCodec used on this port.   
	 * @param port
	 * 		The port to open
	 * @param codec
	 * 		The codec to use for encoding and decoding GearmanPackets
	 * @throws IOException
	 * 		thrown if opening the port fails
	 */
// Path: src/org/gearman/core/GearmanCallbackHandler.java
// public interface GearmanCallbackHandler<D,R extends GearmanCallbackResult> {
// 	public void onComplete(D data, R result);
// }
// 
// Path: src/org/gearman/core/GearmanCallbackResult.java
// public interface GearmanCallbackResult {
// 	
// 	/**
// 	 * Tests if the operation completed successfully
// 	 * @return
// 	 * 		<code>true</code> if and only if the operation was successful
// 	 */
// 	public boolean isSuccessful();
// }
// 
// Path: src/org/gearman/core/GearmanCodec.java
// public interface GearmanCodec<X> {
// 	public void init(GearmanCodecChannel<X> channel);
// 	public ByteBuffer createByteBuffer();
// 	public void decode(GearmanCodecChannel<X> channel, int byteCount);
// 	public byte[] encode(GearmanPacket packet);
// }
// 
// Path: src/org/gearman/core/GearmanConnectionHandler.java
// public interface GearmanConnectionHandler<X> {
// 	public void onAccept(GearmanConnection<X> conn);
// 	public void onPacketReceived(GearmanPacket packet, GearmanConnection<X> conn);
// 	public void onDisconnect(GearmanConnection<X> conn);
// }


// Path: src/org/gearman/GearmanServer.java
import java.io.IOException;
import java.util.Set;
import org.gearman.core.GearmanCallbackHandler;
import org.gearman.core.GearmanCallbackResult;
import org.gearman.core.GearmanCodec;
import org.gearman.core.GearmanConnectionHandler;

package org.gearman;



public interface GearmanServer extends GearmanService {
	
	public static enum ConnectCallbackResult implements GearmanCallbackResult{
		SERVER_SHUTDOWN;

		@Override
		public boolean isSuccessful() {
			return false;
		}
	}
	
	/**
	 * Attempts to open the default port to listen on
	 * @throws IOException
	 * 		thrown if opening the port fails
	 */
	public void openPort() throws IOException;
	
	/**
	 * Attempts to open and listen on a given port.
	 * @param port
	 * 		The port to open
	 * @throws IOException
	 * 		thrown if opening the port fails
	 */
	public void openPort(final int port) throws IOException;
	
	/**
	 * Attempts to open and listen on a given port.<br>
	 * <br>
	 * Allows the user specifies the GearmanCodec used on this port.   
	 * @param port
	 * 		The port to open
	 * @param codec
	 * 		The codec to use for encoding and decoding GearmanPackets
	 * @throws IOException
	 * 		thrown if opening the port fails
	 */
	public <X> void openPort(final int port, final GearmanCodec<X> codec) throws IOException;