continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r573562 - in /maven/continuum/trunk: continuum-notifiers/continuum-notifier-irc/src/main/java/org/apache/maven/continuum/notification/irc/ continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/ continuum-webapp/src/m...
Date Fri, 07 Sep 2007 13:01:14 GMT
Author: evenisse
Date: Fri Sep  7 06:01:13 2007
New Revision: 573562

URL: http://svn.apache.org/viewvc?rev=573562&view=rev
Log:
[CONTINUUM-522] Add ssl support

Modified:
    maven/continuum/trunk/continuum-notifiers/continuum-notifier-irc/src/main/java/org/apache/maven/continuum/notification/irc/IrcContinuumNotifier.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/IrcGroupNotifierEditAction.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/IrcProjectNotifierEditAction.java
    maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierIrc.jsp

Modified: maven/continuum/trunk/continuum-notifiers/continuum-notifier-irc/src/main/java/org/apache/maven/continuum/notification/irc/IrcContinuumNotifier.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-notifiers/continuum-notifier-irc/src/main/java/org/apache/maven/continuum/notification/irc/IrcContinuumNotifier.java?rev=573562&r1=573561&r2=573562&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-notifiers/continuum-notifier-irc/src/main/java/org/apache/maven/continuum/notification/irc/IrcContinuumNotifier.java
(original)
+++ maven/continuum/trunk/continuum-notifiers/continuum-notifier-irc/src/main/java/org/apache/maven/continuum/notification/irc/IrcContinuumNotifier.java
Fri Sep  7 06:01:13 2007
@@ -36,6 +36,8 @@
 import org.schwering.irc.lib.IRCEventListener;
 import org.schwering.irc.lib.IRCModeParser;
 import org.schwering.irc.lib.IRCUser;
+import org.schwering.irc.lib.ssl.SSLDefaultTrustManager;
+import org.schwering.irc.lib.ssl.SSLIRCConnection;
 
 import java.io.IOException;
 import java.util.HashMap;
@@ -101,22 +103,32 @@
     // Internal connections 
     // ----------------------------------------------------------------------    
     private IRCConnection getIRConnection( String host, int port, String password, String
nick, String userName,
-                                           String realName, String channel )
+                                           String realName, String channel, boolean ssl )
         throws IOException
     {
         String key = host.toUpperCase() + Integer.toString( port );
-        IRCConnection ircConnection = hostConnections.get( key );
-        if ( ircConnection != null )
+        IRCConnection conn = hostConnections.get( key );
+        if ( conn != null )
         {
-            checkConnection( ircConnection );
-            return ircConnection;
+            checkConnection( conn );
+            return conn;
         }
-        ircConnection = new IRCConnection( host, new int[]{port}, password, nick, userName,
realName );
-        ircConnection.addIRCEventListener( new Listener() );
-        checkConnection( ircConnection );
-        ircConnection.doJoin( channel );
-        hostConnections.put( key, ircConnection );
-        return ircConnection;
+
+        if ( !ssl )
+        {
+            conn = new IRCConnection( host, new int[]{port}, password, nick, userName, realName
);
+        }
+        else
+        {
+            conn = new SSLIRCConnection( host, new int[]{port}, password, nick, userName,
realName );
+            ( (SSLIRCConnection) conn ).addTrustManager( new SSLDefaultTrustManager() );
+        }
+
+        conn.addIRCEventListener( new Listener() );
+        checkConnection( conn );
+        conn.doJoin( channel );
+        hostConnections.put( key, conn );
+        return conn;
     }
 
     private void checkConnection( IRCConnection conn )
@@ -125,6 +137,15 @@
         if ( !conn.isConnected() )
         {
             conn.connect();
+            //required for some servers that are slow to initialise the connection, in most
of case, servers with auth 
+            try
+            {
+                Thread.sleep( 5000 );
+            }
+            catch ( InterruptedException e )
+            {
+                //nothing to do
+            }
         }
     }
 
@@ -208,9 +229,12 @@
 
         String password = (String) configuration.get( "password" );
 
+        boolean isSsl = Boolean.parseBoolean( (String) configuration.get( "ssl" ) );
+
         try
         {
-            IRCConnection ircConnection = getIRConnection( host, port, password, login, fullName,
fullName, channel );
+            IRCConnection ircConnection =
+                getIRConnection( host, port, password, login, fullName, fullName, channel,
isSsl );
             ircConnection.doPrivmsg( channel, generateMessage( project, build ) );
         }
         catch ( IOException e )
@@ -354,7 +378,7 @@
 
         public void onNotice( String target, IRCUser u, String msg )
         {
-            getLogger().debug( target + "> " + u.getNick() + " (notice): " + msg );
+            getLogger().info( target + "> " + u.getNick() + " (notice): " + msg );
         }
 
         public void onPart( String chan, IRCUser u, String msg )
@@ -374,7 +398,7 @@
 
         public void onReply( int num, String value, String msg )
         {
-            getLogger().debug( "Reply #" + num + ": " + value + " " + msg );
+            getLogger().info( "Reply #" + num + ": " + value + " " + msg );
         }
 
         public void onTopic( String chan, IRCUser u, String topic )

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/IrcGroupNotifierEditAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/IrcGroupNotifierEditAction.java?rev=573562&r1=573561&r2=573562&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/IrcGroupNotifierEditAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/IrcGroupNotifierEditAction.java
Fri Sep  7 06:01:13 2007
@@ -49,6 +49,8 @@
 
     private String password;
 
+    private boolean ssl = false;
+
     protected void initConfiguration( Map configuration )
     {
         host = (String) configuration.get( "host" );
@@ -65,6 +67,11 @@
         fullName = (String) configuration.get( "fullName" );
 
         password = (String) configuration.get( "password" );
+
+        if ( configuration.get( "ssl" ) != null )
+        {
+            ssl = Boolean.parseBoolean( (String) configuration.get( "ssl" ) );
+        }
     }
 
     protected void setNotifierConfiguration( ProjectNotifier notifier )
@@ -83,6 +90,8 @@
 
         configuration.put( "password", password );
 
+        configuration.put( "ssl", String.valueOf( ssl ) );
+
         notifier.setConfiguration( configuration );
     }
 
@@ -144,5 +153,15 @@
     public void setPassword( String password )
     {
         this.password = password;
+    }
+
+    public boolean isSsl()
+    {
+        return ssl;
+    }
+
+    public void setSsl( boolean ssl )
+    {
+        this.ssl = ssl;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/IrcProjectNotifierEditAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/IrcProjectNotifierEditAction.java?rev=573562&r1=573561&r2=573562&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/IrcProjectNotifierEditAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/notifier/IrcProjectNotifierEditAction.java
Fri Sep  7 06:01:13 2007
@@ -44,6 +44,8 @@
 
     private String password;
 
+    private boolean ssl = false;
+
     protected void initConfiguration( Map configuration )
     {
         host = (String) configuration.get( "host" );
@@ -60,6 +62,11 @@
         fullName = (String) configuration.get( "fullName" );
 
         password = (String) configuration.get( "password" );
+
+        if ( configuration.get( "ssl" ) != null )
+        {
+            ssl = Boolean.parseBoolean( (String) configuration.get( "ssl" ) );
+        }
     }
 
     protected void setNotifierConfiguration( ProjectNotifier notifier )
@@ -78,6 +85,8 @@
 
         configuration.put( "password", password );
 
+        configuration.put( "ssl", String.valueOf( ssl ) );
+
         notifier.setConfiguration( configuration );
     }
 
@@ -139,5 +148,15 @@
     public void setPassword( String password )
     {
         this.password = password;
+    }
+
+    public boolean isSsl()
+    {
+        return ssl;
+    }
+
+    public void setSsl( boolean ssl )
+    {
+        this.ssl = ssl;
     }
 }

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?rev=573562&r1=573561&r2=573562&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Fri Sep  7 06:01:13 2007
@@ -407,6 +407,7 @@
 notifier.irc.nick.label = Nick Name
 notifier.irc.fullName.label = Full Name
 notifier.irc.password.label = Password
+notifier.irc.isSSL.label = SSL
 notifier.jabber.host.label = Jabber Host
 notifier.jabber.port.label = Jabber port
 notifier.jabber.login.label = Jabber login

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierIrc.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierIrc.jsp?rev=573562&r1=573561&r2=573562&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierIrc.jsp
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/notifier/notifierIrc.jsp
Fri Sep  7 06:01:13 2007
@@ -57,6 +57,7 @@
                 <ww:textfield label="%{getText('notifier.irc.nick.label')}" name="nick"/>
                 <ww:textfield label="%{getText('notifier.irc.fullName.label')}" name="fullName"/>
                 <ww:password label="%{getText('notifier.irc.password.label')}" name="password"/>
+                <ww:checkbox label="%{getText('notifier.irc.isSSL.label')}" name="ssl"
value="ssl" fieldValue="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