// Path: src/main/java/com/tobedevoured/naether/util/RepoBuilder.java
// public final class RepoBuilder {
// 
//     private RepoBuilder() { }
//     
//     /**
//      * Create a {@link RemoteRepository} from a String url
//      * 
//      * @param url String
//      * @return {@link RemoteRepository}
//      * @throws MalformedURLException exceptions
//      */
//     public static RemoteRepository remoteRepositoryFromUrl(String url) throws MalformedURLException {
//         URL parsedUrl = new URL(url);
// 
//         StringBuffer id = new StringBuffer(parsedUrl.getHost());
//         String path = parsedUrl.getPath();
//         if (path.length() > 0) {
//             path = path.replaceFirst("/", "").replaceAll("/", "-").replaceAll(":", "-");
//             id.append("-");
//             id.append(path);
//         }
// 
//         if (parsedUrl.getPort() > -1) {
//             id.append("-");
//             id.append(parsedUrl.getPort());
//         }
// 
//         return new RemoteRepository(id.toString(), "default", url);
//     }
//     
//     /**
//      * Create a {@link Repository} from a String url
//      * 
//      * @param url String
//      * @return {@link Repository}
//      * @throws MalformedURLException exception
//      */
//     public static Repository repositoryFromUrl(String url) throws MalformedURLException {
//         URL parsedUrl = new URL(url);
// 
//         StringBuffer id = new StringBuffer(parsedUrl.getHost());
//         String path = parsedUrl.getPath();
//         if (path.length() > 0) {
//             path = path.replaceFirst("/", "").replaceAll("/", "-").replaceAll(":", "-");
//             id.append("-");
//             id.append(path);
//         }
// 
//         if (parsedUrl.getPort() > -1) {
//             id.append("-");
//             id.append(parsedUrl.getPort());
//         }
// 
//         Repository repo = new Repository();
//         repo.setId( id.toString() );
//         repo.setName( parsedUrl.getHost() );
//         repo.setUrl( url );
//         
//         return repo;
//     }
// }


import java.io.File;
import java.net.MalformedURLException;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.repository.Authentication;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.util.artifact.DefaultArtifact;
import org.sonatype.aether.util.artifact.SubArtifact;
import com.tobedevoured.naether.util.RepoBuilder;
    }
    
    public DeployArtifact( String notation, String filePath, RemoteRepository remoteRepo ) {
        this.notation = notation;
        jarArtifact = new DefaultArtifact( notation );
        
        this.filePath = filePath;
        jarArtifact = jarArtifact.setFile( new File( filePath ) );
        
        this.remoteRepo = remoteRepo;
    }
    
    public void setAuth( String username, String password ) {
        authentication = new Authentication( username, password );
        
        if ( getRemoteRepo() != null ) {
            getRemoteRepo().setAuthentication( authentication );
        }
    }
    
    public void setAuth( String username, String password, String publicKeyFile, String passphrase ) {
        authentication = new Authentication( username, password, publicKeyFile, passphrase );
        
        if ( getRemoteRepo() != null ) {
            getRemoteRepo().setAuthentication( authentication );
        }
    }


    public void setRemoteRepo( String url ) throws MalformedURLException {
// Path: src/main/java/com/tobedevoured/naether/util/RepoBuilder.java
// public final class RepoBuilder {
// 
//     private RepoBuilder() { }
//     
//     /**
//      * Create a {@link RemoteRepository} from a String url
//      * 
//      * @param url String
//      * @return {@link RemoteRepository}
//      * @throws MalformedURLException exceptions
//      */
//     public static RemoteRepository remoteRepositoryFromUrl(String url) throws MalformedURLException {
//         URL parsedUrl = new URL(url);
// 
//         StringBuffer id = new StringBuffer(parsedUrl.getHost());
//         String path = parsedUrl.getPath();
//         if (path.length() > 0) {
//             path = path.replaceFirst("/", "").replaceAll("/", "-").replaceAll(":", "-");
//             id.append("-");
//             id.append(path);
//         }
// 
//         if (parsedUrl.getPort() > -1) {
//             id.append("-");
//             id.append(parsedUrl.getPort());
//         }
// 
//         return new RemoteRepository(id.toString(), "default", url);
//     }
//     
//     /**
//      * Create a {@link Repository} from a String url
//      * 
//      * @param url String
//      * @return {@link Repository}
//      * @throws MalformedURLException exception
//      */
//     public static Repository repositoryFromUrl(String url) throws MalformedURLException {
//         URL parsedUrl = new URL(url);
// 
//         StringBuffer id = new StringBuffer(parsedUrl.getHost());
//         String path = parsedUrl.getPath();
//         if (path.length() > 0) {
//             path = path.replaceFirst("/", "").replaceAll("/", "-").replaceAll(":", "-");
//             id.append("-");
//             id.append(path);
//         }
// 
//         if (parsedUrl.getPort() > -1) {
//             id.append("-");
//             id.append(parsedUrl.getPort());
//         }
// 
//         Repository repo = new Repository();
//         repo.setId( id.toString() );
//         repo.setName( parsedUrl.getHost() );
//         repo.setUrl( url );
//         
//         return repo;
//     }
// }


// Path: src/main/java/com/tobedevoured/naether/deploy/DeployArtifact.java
import java.io.File;
import java.net.MalformedURLException;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.repository.Authentication;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.util.artifact.DefaultArtifact;
import org.sonatype.aether.util.artifact.SubArtifact;
import com.tobedevoured.naether.util.RepoBuilder;

    }
    
    public DeployArtifact( String notation, String filePath, RemoteRepository remoteRepo ) {
        this.notation = notation;
        jarArtifact = new DefaultArtifact( notation );
        
        this.filePath = filePath;
        jarArtifact = jarArtifact.setFile( new File( filePath ) );
        
        this.remoteRepo = remoteRepo;
    }
    
    public void setAuth( String username, String password ) {
        authentication = new Authentication( username, password );
        
        if ( getRemoteRepo() != null ) {
            getRemoteRepo().setAuthentication( authentication );
        }
    }
    
    public void setAuth( String username, String password, String publicKeyFile, String passphrase ) {
        authentication = new Authentication( username, password, publicKeyFile, passphrase );
        
        if ( getRemoteRepo() != null ) {
            getRemoteRepo().setAuthentication( authentication );
        }
    }


    public void setRemoteRepo( String url ) throws MalformedURLException {
        this.setRemoteRepo( RepoBuilder.remoteRepositoryFromUrl( url ) );