Author: brett
Date: Wed Sep 21 01:53:46 2005
New Revision: 290660
URL: http://svn.apache.org/viewcvs?rev=290660&view=rev
Log:
PR: MNG-575
Submitted by: Jesse McConnell
Reviewed by: Brett Porter
Add a way to configure permissions on deployed files
Modified:
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonManager.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
maven/components/trunk/maven-settings/settings.mdo
Modified:
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java?rev=290660&r1=290659&r2=290660&view=diff
==============================================================================
---
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
(original)
+++
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
Wed Sep 21 01:53:46 2005
@@ -33,6 +33,7 @@
import org.apache.maven.wagon.observers.ChecksumObserver;
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.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
import
org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
@@ -63,6 +64,8 @@
private Map authenticationInfoMap = new HashMap();
+ private Map serverPermissionsMap = new HashMap();
+
private Map mirrors = new HashMap();
private TransferListener downloadMonitor;
@@ -139,8 +142,21 @@
try
{
- wagon.connect( new Repository( repository.getId(),
repository.getUrl() ),
- getAuthenticationInfo( repository.getId() ),
getProxy( protocol ) );
+ Repository artifactRepository = new Repository(
repository.getId(), repository.getUrl() );
+
+ 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
+ {
+ getLogger().debug( "not adding permissions to wagon
connection" );
+ }
+
+ wagon.connect( artifactRepository, getAuthenticationInfo(
repository.getId() ), getProxy( protocol ) );
wagon.put( source, remotePath );
@@ -307,6 +323,7 @@
try
{
+
wagon.connect( new Repository( repository.getId(),
repository.getUrl() ),
getAuthenticationInfo( repository.getId() ),
getProxy( protocol ) );
@@ -591,6 +608,30 @@
authInfo.setPassphrase( passphrase );
authenticationInfoMap.put( repositoryId, authInfo );
+ }
+
+ public void addPermissionInfo( String repositoryId, String
filePermissions, String directoryPermissions )
+ {
+
+ RepositoryPermissions permissions = new RepositoryPermissions();
+ boolean addPermissions = false;
+
+ if ( filePermissions != null )
+ {
+ permissions.setFileMode( filePermissions );
+ addPermissions = true;
+ }
+
+ if ( directoryPermissions != null )
+ {
+ permissions.setDirectoryMode( directoryPermissions );
+ addPermissions = true;
+ }
+
+ if ( addPermissions )
+ {
+ serverPermissionsMap.put( repositoryId, permissions );
+ }
}
public void addMirror( String id, String mirrorOf, String url )
Modified:
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonManager.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonManager.java?rev=290660&r1=290659&r2=290660&view=diff
==============================================================================
---
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonManager.java
(original)
+++
maven/components/trunk/maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/WagonManager.java
Wed Sep 21 01:53:46 2005
@@ -66,6 +66,8 @@
void setDownloadMonitor( TransferListener downloadMonitor );
+ void addPermissionInfo( String repositoryId, String filePermissions,
String directoryPermissions );
+
ProxyInfo getProxy( String protocol );
AuthenticationInfo getAuthenticationInfo( String id );
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=290660&r1=290659&r2=290660&view=diff
==============================================================================
---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
(original)
+++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
Wed Sep 21 01:53:46 2005
@@ -338,7 +338,7 @@
File file = (File) iterator.next();
boolean usingReleasePom = false;
-
+
if ( RELEASE_POMv4.equals( file.getName() ) )
{
getLogger().info( "NOTE: Using release-pom: " + file + " in
reactor build." );
@@ -369,9 +369,9 @@
for ( Iterator i = project.getModules().iterator();
i.hasNext(); )
{
String name = (String) i.next();
-
+
File moduleFile;
-
+
if ( usingReleasePom )
{
moduleFile = new File( basedir, name + "/" +
Maven.RELEASE_POMv4 );
@@ -380,7 +380,7 @@
{
moduleFile = new File( basedir, name + "/" +
Maven.POMv4 );
}
-
+
moduleFiles.add( moduleFile );
}
@@ -475,6 +475,9 @@
wagonManager.addAuthenticationInfo( server.getId(),
server.getUsername(), server.getPassword(),
server.getPrivateKey(),
server.getPassphrase() );
+
+ wagonManager.addPermissionInfo( server.getId(),
server.getFilePermissions(),
+
server.getDirectoryPermissions() );
}
for ( Iterator i = settings.getMirrors().iterator(); i.hasNext(); )
Modified: maven/components/trunk/maven-settings/settings.mdo
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-settings/settings.mdo?rev=290660&r1=290659&r2=290660&view=diff
==============================================================================
--- maven/components/trunk/maven-settings/settings.mdo (original)
+++ maven/components/trunk/maven-settings/settings.mdo Wed Sep 21 01:53:46 2005
@@ -17,7 +17,8 @@
<class>
<name>TrackableBase</name>
<version>1.0.0</version>
- <description>common base class that contains code to track the source
for this instance (USER|GLOBAL)</description>
+ <description>common base class that contains code to track the source
for this instance
+ (USER|GLOBAL)</description>
<codeSegments>
<codeSegment>
<version>1.0.0</version>
@@ -90,7 +91,8 @@
<field>
<name>usePluginRegistry</name>
<version>1.0.0</version>
- <description><![CDATA[Whether Maven should use the
plugin-registry.xml file to manage plugin versions.]]></description>
+ <description>
+ <![CDATA[Whether Maven should use the plugin-registry.xml file to
manage plugin versions.]]></description>
<type>boolean</type>
<defaultValue>true</defaultValue>
</field>
@@ -107,7 +109,7 @@
<version>1.0.0</version>
<required>false</required>
<description><![CDATA[Indicate whether maven should operate in
offline mode full-time.]]>
- </description>
+ </description>
<type>boolean</type>
<defaultValue>false</defaultValue>
</field>
@@ -158,8 +160,8 @@
<field>
<name>mirrors</name>
<version>1.0.0</version>
- <description> Configuration of download mirrors for repositories.
- </description>
+ <description>Configuration of download mirrors for repositories.
+ </description>
<association>
<type>Mirror</type>
<multiplicity>*</multiplicity>
@@ -192,7 +194,8 @@
<field>
<name>pluginGroups</name>
<version>1.0.0</version>
- <description>List of groupIds to search for a plugin when that
plugin groupId is not explicitly provided.</description>
+ <description>List of groupIds to search for a plugin when that
plugin groupId is not explicitly
+ provided.</description>
<association>
<type>String</type>
<multiplicity>*</multiplicity>
@@ -372,7 +375,7 @@
<required>false</required>
<defaultValue>false</defaultValue>
<description><![CDATA[Whether this proxy configuration is the active
one.]]>
- </description>
+ </description>
<type>boolean</type>
</field>
<field>
@@ -426,7 +429,7 @@
<name>username</name>
<version>1.0.0</version>
<description><![CDATA[The username used to authenticate.]]>
- </description>
+ </description>
<type>String</type>
</field>
<field>
@@ -441,7 +444,7 @@
<name>privateKey</name>
<version>1.0.0</version>
<description><![CDATA[The private key location used to
authenticate.]]>
- </description>
+ </description>
<type>String</type>
</field>
<field>
@@ -452,36 +455,52 @@
]]></description>
<type>String</type>
</field>
+ <field>
+ <name>filePermissions</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ The permissions for files when they are created.
+ ]]></description>
+ <type>String</type>
+ </field>
+ <field>
+ <name>directoryPermissions</name>
+ <version>1.0.0</version>
+ <description><![CDATA[
+ The permissions for directories when they are created.
+ ]]></description>
+ <type>String</type>
+ </field>
</fields>
</class>
<class>
<name>Mirror</name>
<version>1.0.0</version>
<superClass>IdentifiableBase</superClass>
- <description> A download mirror for a given repository. </description>
+ <description>A download mirror for a given repository.</description>
<fields>
<field>
<name>mirrorOf</name>
<required>true</required>
<version>1.0.0</version>
<type>String</type>
- <description> The server ID of the repository being mirrored, eg
- "central". This MUST NOT match the mirror id. </description>
+ <description>The server ID of the repository being mirrored, eg
+ "central". This MUST NOT match the mirror id.</description>
</field>
<field>
<name>name</name>
<required>false</required>
<version>1.0.0</version>
<type>String</type>
- <description> The optional name that describes the mirror.
- </description>
+ <description>The optional name that describes the mirror.
+ </description>
</field>
<field>
<name>url</name>
<required>true</required>
<version>1.0.0</version>
<type>String</type>
- <description> The URL of the mirror repository. </description>
+ <description>The URL of the mirror repository.</description>
</field>
<!--
<field>
@@ -524,7 +543,7 @@
</field>
<field>
<name>properties</name>
- <description>Extended configuration specific to this profile goes
+ <description>Extended configuration specific to this profile goes
here.</description>
<type>Properties</type>
<association xml.mapStyle="inline">
@@ -536,7 +555,7 @@
<name>repositories</name>
<version>1.0.0</version>
<description><![CDATA[The lists of the remote repositories]]>
- </description>
+ </description>
<association>
<type>Repository</type>
<multiplicity>*</multiplicity>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]