// 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/factories/GitSCMCommandFactory.java
// public class GitSCMCommandFactory implements ISCMCommandFactory {
// 
// 	public static final String REPOSITORY_BASE = "repositoryBase";
// 
// 	public Command create(FilteredCommand filteredCommand,
// 			IProjectAuthorizer projectAuthorizer,
// 			IPathToProjectNameConverter pathToProjectNameConverter,
// 			Properties configuration) {
// 		SCMCommand retVal = new SCMCommand(filteredCommand, projectAuthorizer, new GitSCMCommandHandler(), pathToProjectNameConverter, configuration);
// 		return retVal;
// 	}
// 
// }


import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Properties;
import org.apache.sshd.server.CommandFactory.ExitCallback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spearce.jgit.lib.Repository;
import org.spearce.jgit.transport.UploadPack;
import com.asolutions.scmsshd.authorizors.AuthorizationLevel;
import com.asolutions.scmsshd.commands.FilteredCommand;
import com.asolutions.scmsshd.commands.factories.GitSCMCommandFactory;
package com.asolutions.scmsshd.commands.git;




public class GitUploadPackSCMCommandHandler extends GitSCMCommandImpl {
	protected final Logger log = LoggerFactory.getLogger(getClass());
	private GitSCMRepositoryProvider repositoryProvider;
	private GitUploadPackProvider uploadPackProvider;
	
	public GitUploadPackSCMCommandHandler() {
		this(new GitSCMRepositoryProvider(), 
			 new GitUploadPackProvider());
	}

	public GitUploadPackSCMCommandHandler(
			GitSCMRepositoryProvider repositoryProvider,
			GitUploadPackProvider uploadPackProvider) {
		this.repositoryProvider = repositoryProvider;
		this.uploadPackProvider = uploadPackProvider;
	}

	@Override
	protected void runCommand(FilteredCommand filteredCommand,
			InputStream inputStream, OutputStream outputStream,
			OutputStream errorStream, ExitCallback exitCallback,
			Properties config, AuthorizationLevel authorizationLevel)
			throws IOException {
		log.info("Starting Upload Pack Of: " + filteredCommand.getArgument());
		
// 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/factories/GitSCMCommandFactory.java
// public class GitSCMCommandFactory implements ISCMCommandFactory {
// 
// 	public static final String REPOSITORY_BASE = "repositoryBase";
// 
// 	public Command create(FilteredCommand filteredCommand,
// 			IProjectAuthorizer projectAuthorizer,
// 			IPathToProjectNameConverter pathToProjectNameConverter,
// 			Properties configuration) {
// 		SCMCommand retVal = new SCMCommand(filteredCommand, projectAuthorizer, new GitSCMCommandHandler(), pathToProjectNameConverter, configuration);
// 		return retVal;
// 	}
// 
// }


// Path: src/main/java/com/asolutions/scmsshd/commands/git/GitUploadPackSCMCommandHandler.java
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Properties;
import org.apache.sshd.server.CommandFactory.ExitCallback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spearce.jgit.lib.Repository;
import org.spearce.jgit.transport.UploadPack;
import com.asolutions.scmsshd.authorizors.AuthorizationLevel;
import com.asolutions.scmsshd.commands.FilteredCommand;
import com.asolutions.scmsshd.commands.factories.GitSCMCommandFactory;

package com.asolutions.scmsshd.commands.git;




public class GitUploadPackSCMCommandHandler extends GitSCMCommandImpl {
	protected final Logger log = LoggerFactory.getLogger(getClass());
	private GitSCMRepositoryProvider repositoryProvider;
	private GitUploadPackProvider uploadPackProvider;
	
	public GitUploadPackSCMCommandHandler() {
		this(new GitSCMRepositoryProvider(), 
			 new GitUploadPackProvider());
	}

	public GitUploadPackSCMCommandHandler(
			GitSCMRepositoryProvider repositoryProvider,
			GitUploadPackProvider uploadPackProvider) {
		this.repositoryProvider = repositoryProvider;
		this.uploadPackProvider = uploadPackProvider;
	}

	@Override
	protected void runCommand(FilteredCommand filteredCommand,
			InputStream inputStream, OutputStream outputStream,
			OutputStream errorStream, ExitCallback exitCallback,
			Properties config, AuthorizationLevel authorizationLevel)
			throws IOException {
		log.info("Starting Upload Pack Of: " + filteredCommand.getArgument());
		
		String strRepoBase = config.getProperty(GitSCMCommandFactory.REPOSITORY_BASE);