// Path: src/main/java/com/asolutions/scmsshd/authorizors/AuthorizationLevel.java
// public enum AuthorizationLevel {
// 	AUTH_LEVEL_READ_ONLY, 
// 	AUTH_LEVEL_READ_WRITE;
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/FilteredCommand.java
// public class FilteredCommand {
// 	
// 	private String command;
// 	private String argument;
// 
// 	public FilteredCommand() {
// 	}
// 	
// 	public FilteredCommand(String command, String argument) {
// 		this.command = command;
// 		this.argument = argument;
// 	}
// 
// 	public void setArgument(String argument) {
// 		this.argument = argument;
// 	}
// 	
// 	public void setCommand(String command) {
// 		this.command = command;
// 	}
// 
// 	public String getCommand() {
// 		return this.command;
// 	}
// 
// 	public String getArgument() {
// 		return this.argument;
// 	}
// 	
// 	@Override
// 	public String toString()
// 	{
// 		return "Filtered Command: " + getCommand() + ", " + getArgument();
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/handlers/ISCMCommandHandler.java
// public interface ISCMCommandHandler {
// 
// 	void execute(FilteredCommand filteredCommand, InputStream inputStream,
// 			OutputStream outputStream, OutputStream errorStream,
// 			ExitCallback exitCallback, Properties configuration, AuthorizationLevel authorizationLevel);
// 
// }


import java.io.InputStream;
import java.io.OutputStream;
import java.util.Properties;
import org.apache.sshd.server.CommandFactory.ExitCallback;
import com.asolutions.scmsshd.authorizors.AuthorizationLevel;
import com.asolutions.scmsshd.commands.FilteredCommand;
import com.asolutions.scmsshd.commands.handlers.ISCMCommandHandler;
package com.asolutions.scmsshd.commands.git;




public class GitSCMCommandHandler implements ISCMCommandHandler {
	
	private ISCMCommandHandler uploadPackHandler;
	private ISCMCommandHandler receivePackHandler;

	public GitSCMCommandHandler() {
		this(new GitUploadPackSCMCommandHandler(), new GitReceivePackSCMCommandHandler());
	}

	public GitSCMCommandHandler(ISCMCommandHandler uploadPackHandler,
			                    ISCMCommandHandler receivePackHandler) {
		this.uploadPackHandler = uploadPackHandler;
		this.receivePackHandler = receivePackHandler;
	}

	public void execute(FilteredCommand filteredCommand,
			InputStream inputStream, OutputStream outputStream,
			OutputStream errorStream, ExitCallback exitCallback, 
			Properties configuration,
			AuthorizationLevel authorizationLevel) {
		ISCMCommandHandler handler = null;
		if ("git-upload-pack".equals(filteredCommand.getCommand())){
			handler = uploadPackHandler;
		}
		else if ("git-receive-pack".equals(filteredCommand.getCommand()))
		{
			handler = receivePackHandler;
		}
// Path: src/main/java/com/asolutions/scmsshd/authorizors/AuthorizationLevel.java
// public enum AuthorizationLevel {
// 	AUTH_LEVEL_READ_ONLY, 
// 	AUTH_LEVEL_READ_WRITE;
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/FilteredCommand.java
// public class FilteredCommand {
// 	
// 	private String command;
// 	private String argument;
// 
// 	public FilteredCommand() {
// 	}
// 	
// 	public FilteredCommand(String command, String argument) {
// 		this.command = command;
// 		this.argument = argument;
// 	}
// 
// 	public void setArgument(String argument) {
// 		this.argument = argument;
// 	}
// 	
// 	public void setCommand(String command) {
// 		this.command = command;
// 	}
// 
// 	public String getCommand() {
// 		return this.command;
// 	}
// 
// 	public String getArgument() {
// 		return this.argument;
// 	}
// 	
// 	@Override
// 	public String toString()
// 	{
// 		return "Filtered Command: " + getCommand() + ", " + getArgument();
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/handlers/ISCMCommandHandler.java
// public interface ISCMCommandHandler {
// 
// 	void execute(FilteredCommand filteredCommand, InputStream inputStream,
// 			OutputStream outputStream, OutputStream errorStream,
// 			ExitCallback exitCallback, Properties configuration, AuthorizationLevel authorizationLevel);
// 
// }


// Path: src/main/java/com/asolutions/scmsshd/commands/git/GitSCMCommandHandler.java
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Properties;
import org.apache.sshd.server.CommandFactory.ExitCallback;
import com.asolutions.scmsshd.authorizors.AuthorizationLevel;
import com.asolutions.scmsshd.commands.FilteredCommand;
import com.asolutions.scmsshd.commands.handlers.ISCMCommandHandler;

package com.asolutions.scmsshd.commands.git;




public class GitSCMCommandHandler implements ISCMCommandHandler {
	
	private ISCMCommandHandler uploadPackHandler;
	private ISCMCommandHandler receivePackHandler;

	public GitSCMCommandHandler() {
		this(new GitUploadPackSCMCommandHandler(), new GitReceivePackSCMCommandHandler());
	}

	public GitSCMCommandHandler(ISCMCommandHandler uploadPackHandler,
			                    ISCMCommandHandler receivePackHandler) {
		this.uploadPackHandler = uploadPackHandler;
		this.receivePackHandler = receivePackHandler;
	}

	public void execute(FilteredCommand filteredCommand,
			InputStream inputStream, OutputStream outputStream,
			OutputStream errorStream, ExitCallback exitCallback, 
			Properties configuration,
			AuthorizationLevel authorizationLevel) {
		ISCMCommandHandler handler = null;
		if ("git-upload-pack".equals(filteredCommand.getCommand())){
			handler = uploadPackHandler;
		}
		else if ("git-receive-pack".equals(filteredCommand.getCommand()))
		{
			handler = receivePackHandler;
		}
		if (handler != null)