public String getName() { if ( name == null ) { return getId(); } return name; }
public String getName() { if ( name == null ) { return getId(); } return name; }
private void raiseAndtroubleShootPassword() throws AuthorizationException { StringBuffer buf = new StringBuffer(); buf.append("\n\n\n-----AUTHENTICATION ERROR-----\n"); buf.append("Cannot find password for repository id:"); buf.append(getRepository().getId()); buf.append(" in settings.xml!\n"); buf.append("-----AUTHENTICATION ERROR-----\n\n\n"); throw new AuthorizationException(buf.toString()); }
/** * Use wagon to deploy the generated site to a given repository. * * @param repository the repository to deploy to. * This needs to contain a valid, non-null {@link Repository#getId() id} * to look up credentials for the deploy, and a valid, non-null * {@link Repository#getUrl() scm url} to deploy to. * @throws MojoExecutionException if the deploy fails. */ private void deployTo( final Repository repository ) throws MojoExecutionException { if ( !inputDirectory.exists() ) { throw new MojoExecutionException( "The site does not exist, please run site:site first" ); } if ( getLog().isDebugEnabled() ) { getLog().debug( "Deploying to '" + repository.getUrl() + "',\n Using credentials from server id '" + repository.getId() + "'" ); } deploy( inputDirectory, repository ); }
public Wagon getWagon( Repository repository ) throws UnsupportedProtocolException, WagonConfigurationException { String protocol = repository.getProtocol(); if ( protocol == null ) { throw new UnsupportedProtocolException( "The repository " + repository + " does not specify a protocol" ); } Wagon wagon = getWagon( protocol, repository.getId() ); return wagon; }
= new RemoteRepository(repo.getId(), "default", repo.getUrl()); remotes.add(remoteRepo);
final String relativeDir, final Log log) throws MojoExecutionException { AuthenticationInfo authenticationInfo = manager.getAuthenticationInfo(repository.getId()); log.debug("authenticationInfo with id '" + repository.getId() + "': " + ((authenticationInfo == null) ? "-" : authenticationInfo.getUserName()));
public void transferStarted( TransferEvent event ) { long contentLength = event.getResource().getContentLength(); if ( contentLength > 0 ) { log( "Transferring " + ( ( contentLength + KILO / 2 ) / KILO ) + "K from " + event.getWagon().getRepository().getId() ); } } }
private void deploy(SiteImpl site, File directory, Repository repository) throws MojoExecutionException, MojoFailureException { // TODO: work on moving this into the deployer like the other deploy // methods final Wagon wagon = getWagon(repository, wagonManager); try { configureWagon(wagon, repository.getId(), settings, container, getLog()); } catch (WagonConfigurationException e) { throw new MojoExecutionException("Unable to configure Wagon: '" + repository.getProtocol() + "'", e); } String relativeDir = site.getRoot(); if ("".equals(relativeDir)) { relativeDir = "./"; } else if (relativeDir.startsWith("/")) { relativeDir = relativeDir.substring(1); } try { final ProxyInfo proxyInfo = getProxyInfo(repository, wagonManager); push(directory, repository, wagonManager, wagon, proxyInfo, relativeDir, getLog()); if (chmod) { chmod(wagon, repository, chmodOptions, chmodMode); } } finally { try { wagon.disconnect(); } catch (ConnectionException e) { getLog().error("Error disconnecting wagon - ignored", e); } } }
protected Wagon getWagon(Repository repository) throws Exception { Wagon wagon = wagonManager.getWagon(repository); wagon.setTimeout(1000); if (getLog().isDebugEnabled()) { Debug debug = new Debug(); wagon.addSessionListener(debug); wagon.addTransferListener(debug); } // FIXME when upgrading to maven 3.x : this must be changed. AuthenticationInfo auth = wagonManager.getAuthenticationInfo(repository.getId()); ProxyInfo proxyInfo = getProxyInfo(); if (proxyInfo != null) { wagon.connect(repository, auth, proxyInfo); } else { wagon.connect(repository, auth); } return wagon; }
configureWagon( wagon, repository.getId(), settings, container, getLog() );
public void transferInitiated( TransferEvent event ) { String message = event.getRequestType() == TransferEvent.REQUEST_PUT ? "Uploading" : "Downloading"; String dest = event.getRequestType() == TransferEvent.REQUEST_PUT ? " to " : " from "; log( message + ": " + event.getResource().getName() + dest + "repository " + event.getWagon().getRepository().getId() + " at " + event.getWagon().getRepository().getUrl() ); }
private ArchetypeCatalog downloadCatalog( ArtifactRepository repository ) throws WagonException, IOException, ArchetypeDataSourceException { getLogger().debug( "Searching for remote catalog: " + repository.getUrl() + "/" + ARCHETYPE_CATALOG_FILENAME ); // We use wagon to take advantage of a Proxy that has already been setup in a Maven environment. Repository wagonRepository = new Repository( repository.getId(), repository.getUrl() ); AuthenticationInfo authInfo = getAuthenticationInfo( wagonRepository.getId() ); ProxyInfo proxyInfo = getProxy( wagonRepository.getProtocol() ); Wagon wagon = getWagon( wagonRepository ); File catalog = File.createTempFile( "archetype-catalog", ".xml" ); try { wagon.connect( wagonRepository, authInfo, proxyInfo ); wagon.get( ARCHETYPE_CATALOG_FILENAME, catalog ); return readCatalog( ReaderFactory.newXmlReader( catalog ) ); } finally { disconnectWagon( wagon ); catalog.delete(); } }
insertSystemPropertyToBuf(buf, "java.vm.version"); insertSystemPropertyToBuf(buf, "user.home"); insertKeyValueToBuf(buf, "repository id", getRepository().getId()); insertKeyValueToBuf(buf, "repository url", getRepository().getUrl());