continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r549545 - in /maven/continuum/trunk: continuum-notifiers/continuum-notifier-wagon/src/main/java/org/apache/maven/continuum/notification/wagon/ continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/ continuum-webapp/s...
Date Thu, 21 Jun 2007 16:53:26 GMT
Author: evenisse
Date: Thu Jun 21 09:53:25 2007
New Revision: 549545

URL: http://svn.apache.org/viewvc?view=rev&rev=549545
Log:
Fix the wagon notifier by adding the server id in the notifier page and read the settings.xml
to get the wagon parameters

Modified:
    maven/continuum/trunk/continuum-notifiers/continuum-notifier-wagon/src/main/java/org/apache/maven/continuum/notification/wagon/WagonContinuumNotifier.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction.java
    maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierWagon.jsp

Modified: maven/continuum/trunk/continuum-notifiers/continuum-notifier-wagon/src/main/java/org/apache/maven/continuum/notification/wagon/WagonContinuumNotifier.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-notifiers/continuum-notifier-wagon/src/main/java/org/apache/maven/continuum/notification/wagon/WagonContinuumNotifier.java?view=diff&rev=549545&r1=549544&r2=549545
==============================================================================
--- maven/continuum/trunk/continuum-notifiers/continuum-notifier-wagon/src/main/java/org/apache/maven/continuum/notification/wagon/WagonContinuumNotifier.java
(original)
+++ maven/continuum/trunk/continuum-notifiers/continuum-notifier-wagon/src/main/java/org/apache/maven/continuum/notification/wagon/WagonContinuumNotifier.java
Thu Jun 21 09:53:25 2007
@@ -40,6 +40,8 @@
 import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.project.ProjectBuildingException;
 import org.apache.maven.settings.MavenSettingsBuilder;
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Server;
 import org.apache.maven.settings.Settings;
 import org.apache.maven.wagon.CommandExecutionException;
 import org.apache.maven.wagon.CommandExecutor;
@@ -49,6 +51,7 @@
 import org.apache.maven.wagon.UnsupportedProtocolException;
 import org.apache.maven.wagon.Wagon;
 import org.apache.maven.wagon.authentication.AuthenticationException;
+import org.apache.maven.wagon.authentication.AuthenticationInfo;
 import org.apache.maven.wagon.authorization.AuthorizationException;
 import org.apache.maven.wagon.observers.Debug;
 import org.apache.maven.wagon.proxy.ProxyInfo;
@@ -64,6 +67,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -164,6 +168,7 @@
         if ( configuration.containsKey( "url" ) )
         {
             url = (String) configuration.get( "url" );
+            id = (String) configuration.get( "id" );
         }
         else
         {
@@ -219,15 +224,15 @@
                 wagon.addTransferListener( debug );
             }
 
-            ProxyInfo proxyInfo = wagonManager.getProxy( repository.getProtocol() );
+            ProxyInfo proxyInfo = getProxyInfo( repository );
 
             if ( proxyInfo != null )
             {
-                wagon.connect( repository, wagonManager.getAuthenticationInfo( id ), proxyInfo
);
+                wagon.connect( repository, getAuthenticationInfo( id ), proxyInfo );
             }
             else
             {
-                wagon.connect( repository, wagonManager.getAuthenticationInfo( id ) );
+                wagon.connect( repository, getAuthenticationInfo( id ) );
             }
 
             File buildOutputFile = configurationService.getBuildOutputFile( build.getId(),
build.getProject().getId() );
@@ -300,7 +305,7 @@
 
         try
         {
-            mavenProject = projectBuilder.build( pomFile, getLocalRepository(), getProfileManager(
settings ) );
+            mavenProject = projectBuilder.build( pomFile, getLocalRepository(), getProfileManager()
);
         }
         catch ( ProjectBuildingException e )
         {
@@ -343,7 +348,7 @@
         return new DefaultArtifactRepository( "local-repository", "file://" + repo, new DefaultRepositoryLayout()
);
     }
 
-    private ProfileManager getProfileManager( Settings settings )
+    private ProfileManager getProfileManager()
     {
         if ( profileManager == null )
         {
@@ -357,5 +362,35 @@
         throws ContextException
     {
         container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
+    }
+
+    private ProxyInfo getProxyInfo( Repository repository )
+    {
+        Settings settings = getSettings();
+        if ( settings.getProxies() != null && !settings.getProxies().isEmpty() )
+        {
+            for ( Iterator i = settings.getProxies().iterator(); i.hasNext(); )
+            {
+                Proxy p = (Proxy) i.next();
+                wagonManager.addProxy( p.getProtocol(), p.getHost(), p.getPort(), p.getUsername(),
p.getPassword(),
+                                       p.getNonProxyHosts() );
+            }
+        }
+        return wagonManager.getProxy( repository.getProtocol() );
+    }
+
+    private AuthenticationInfo getAuthenticationInfo( String repositoryId )
+    {
+        Settings settings = getSettings();
+        Server server = settings.getServer( repositoryId );
+
+        if ( server == null )
+        {
+            return null;
+        }
+
+        wagonManager.addAuthenticationInfo( repositoryId, server.getUsername(), server.getPassword(),
+                                            server.getPrivateKey(), server.getPassphrase()
);
+        return wagonManager.getAuthenticationInfo( repositoryId );
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction.java?view=diff&rev=549545&r1=549544&r2=549545
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction.java
Thu Jun 21 09:53:25 2007
@@ -38,6 +38,8 @@
 {
     private String url;
 
+    private String id;
+
     protected void initConfiguration( Map configuration )
     {
         url = (String) configuration.get( "url" );
@@ -49,6 +51,8 @@
 
         configuration.put( "url", url );
 
+        configuration.put( "id", id );
+
         notifier.setConfiguration( configuration );
     }
 
@@ -60,5 +64,15 @@
     public void setUrl( String url )
     {
         this.url = url;
+    }
+
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId( String id )
+    {
+        this.id = id;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction.java?view=diff&rev=549545&r1=549544&r2=549545
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction.java
Thu Jun 21 09:53:25 2007
@@ -38,6 +38,8 @@
 {
     private String url;
 
+    private String id;
+
     protected void initConfiguration( Map configuration )
     {
         url = (String) configuration.get( "url" );
@@ -49,6 +51,8 @@
 
         configuration.put( "url", url );
 
+        configuration.put( "id", id );
+
         notifier.setConfiguration( configuration );
     }
 
@@ -60,5 +64,15 @@
     public void setUrl( String url )
     {
         this.url = url;
+    }
+
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId( String id )
+    {
+        this.id = id;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?view=diff&rev=549545&r1=549544&r2=549545
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Thu Jun 21 09:53:25 2007
@@ -398,6 +398,7 @@
 notifier.msn.password.label = MSN Password
 notifier.msn.address.label = MSN Recipient Address
 notifier.wagon.url.label = Project Site URL
+notifier.wagon.id.label = Server Id (defined in your settings.xml for authentication)
 notifier.event.sendOnSuccess = Send on Success
 notifier.event.sendOnFailure = Send on Failure
 notifier.event.sendOnError = Send on Error

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierWagon.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierWagon.jsp?view=diff&rev=549545&r1=549544&r2=549545
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierWagon.jsp
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierWagon.jsp
Thu Jun 21 09:53:25 2007
@@ -54,6 +54,7 @@
             <table>
               <tbody>
                 <ww:textfield label="%{getText('notifier.wagon.url.label')}" name="url"
required="true" />
+                <ww:textfield label="%{getText('notifier.wagon.id.label')}" name="id"
required="true" />
                 <ww:checkbox label="%{getText('notifier.event.sendOnSuccess')}" name="sendOnSuccess"
value="sendOnSuccess" fieldValue="true"/>
                 <ww:checkbox label="%{getText('notifier.event.sendOnFailure')}" name="sendOnFailure"
value="sendOnFailure" fieldValue="true"/>
                 <ww:checkbox label="%{getText('notifier.event.sendOnError')}" name="sendOnError"
value="sendOnError" fieldValue="true"/>



Mime
View raw message