o fixing default perms for deployment

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@521340 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2007-03-22 16:49:57 +00:00
parent 17a7a726c5
commit ccb49439ee
3 changed files with 26 additions and 6 deletions

View File

@ -1,4 +1,4 @@
package org.apache.maven.artifact.manager;
package org.apache.maven.artifact.manager;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -74,7 +74,7 @@ public class DefaultWagonManager
// TODO: proxies, authentication and mirrors are via settings, and should come in via an alternate method - perhaps
// attached to ArtifactRepository before the method is called (so AR would be composed of WR, not inherit it)
private Map proxies = new HashMap();
private Map authenticationInfoMap = new HashMap();
private Map serverPermissionsMap = new HashMap();
@ -96,6 +96,8 @@ public class DefaultWagonManager
private Map availableWagons = new HashMap();
private RepositoryPermissions defaultRepositoryPermissions;
// TODO: this leaks the component in the public api - it is never released back to the container
public Wagon getWagon( Repository repository )
throws UnsupportedProtocolException, WagonConfigurationException
@ -209,8 +211,10 @@ public class DefaultWagonManager
if ( serverPermissionsMap.containsKey( repository.getId() ) )
{
RepositoryPermissions perms = (RepositoryPermissions) serverPermissionsMap.get( repository.getId() );
getLogger().debug(
"adding permissions to wagon connection: " + perms.getFileMode() + " " + perms.getDirectoryMode() );
artifactRepository.setPermissions( perms );
}
else
@ -744,8 +748,8 @@ public class DefaultWagonManager
public void addPermissionInfo( String repositoryId, String filePermissions, String directoryPermissions )
{
RepositoryPermissions permissions = new RepositoryPermissions();
boolean addPermissions = false;
if ( filePermissions != null )
@ -871,4 +875,8 @@ public class DefaultWagonManager
serverConfigurationMap.put( repositoryId, xmlConf );
}
public void setDefaultRepositoryPermissions( RepositoryPermissions defaultRepositoryPermissions )
{
this.defaultRepositoryPermissions = defaultRepositoryPermissions;
}
}

View File

@ -30,6 +30,7 @@ import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.events.TransferListener;
import org.apache.maven.wagon.proxy.ProxyInfo;
import org.apache.maven.wagon.repository.Repository;
import org.apache.maven.wagon.repository.RepositoryPermissions;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.util.xml.Xpp3Dom;
@ -118,5 +119,7 @@ public interface WagonManager
void registerWagons( Collection wagons, PlexusContainer extensionContainer );
void findAndRegisterWagons( PlexusContainer container );
void findAndRegisterWagons( PlexusContainer container );
void setDefaultRepositoryPermissions( RepositoryPermissions permissions );
}

View File

@ -20,6 +20,7 @@ package org.apache.maven.embedder.execution;
*/
import org.apache.maven.SettingsConfigurationException;
import org.apache.maven.wagon.repository.RepositoryPermissions;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
@ -179,8 +180,7 @@ public class DefaultMavenExecutionRequestDefaultsPopulator
wagonManager.addAuthenticationInfo( server.getId(), server.getUsername(), server.getPassword(),
server.getPrivateKey(), server.getPassphrase() );
wagonManager.addPermissionInfo( server.getId(), server.getFilePermissions(),
server.getDirectoryPermissions() );
wagonManager.addPermissionInfo( server.getId(), server.getFilePermissions(), server.getDirectoryPermissions() );
if ( server.getConfiguration() != null )
{
@ -188,6 +188,15 @@ public class DefaultMavenExecutionRequestDefaultsPopulator
}
}
RepositoryPermissions defaultPermissions = new RepositoryPermissions();
defaultPermissions.setDirectoryMode( "775" );
defaultPermissions.setFileMode( "664" );
wagonManager.setDefaultRepositoryPermissions( defaultPermissions );
for ( Iterator i = settings.getMirrors().iterator(); i.hasNext(); )
{
Mirror mirror = (Mirror) i.next();