You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ma...@apache.org on 2014/03/20 09:16:10 UTC

svn commit: r1579559 [11/23] - in /james/hupa/trunk: ./ client/ client/src/main/java/com/google/web/bindery/requestfactory/server/ client/src/main/java/org/apache/hupa/ client/src/main/java/org/apache/hupa/client/ client/src/main/java/org/apache/hupa/c...

Modified: james/hupa/trunk/client/src/test/java/org/apache/hupa/client/mock/MockWidget.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/test/java/org/apache/hupa/client/mock/MockWidget.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/test/java/org/apache/hupa/client/mock/MockWidget.java (original)
+++ james/hupa/trunk/client/src/test/java/org/apache/hupa/client/mock/MockWidget.java Thu Mar 20 08:16:02 2014
@@ -62,7 +62,7 @@ public class MockWidget implements HasCl
     }
 
     public void setHTML(String html) {
-        this.html = html;   
+        this.html = html;
     }
 
     public int getTabIndex() {

Modified: james/hupa/trunk/client/src/test/java/org/apache/hupa/client/storage/HupaStorageTest.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/test/java/org/apache/hupa/client/storage/HupaStorageTest.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/client/src/test/java/org/apache/hupa/client/storage/HupaStorageTest.java (original)
+++ james/hupa/trunk/client/src/test/java/org/apache/hupa/client/storage/HupaStorageTest.java Thu Mar 20 08:16:02 2014
@@ -15,11 +15,11 @@ import com.google.gwt.query.client.Funct
 import com.google.inject.Inject;
 
 public class HupaStorageTest extends HupaClientTestBase {
-    
+
     @Inject HupaStorage storage;
     @Inject AppCache cache;
     @Inject EventBus eventBus;
-    
+
     @Test
     public void testUserPrefix() {
         String uk1 = cache.enCrypt("manuel.carrasco.m@gmail.com");
@@ -28,7 +28,7 @@ public class HupaStorageTest extends Hup
         System.out.println(uk2);
 //        cache.setPrefix(uk.substring(0, 6) + "_");
     }
-    
+
     @Test
     public void testFolderList() {
         storage.gettingFolders().done(new Function() {
@@ -55,9 +55,9 @@ public class HupaStorageTest extends Hup
                 Assert.assertEquals(4, folderNodes.size());
             }
         });
-        
+
         Assert.assertEquals(5,cache.getLength());
-        
+
         eventBus.fireEvent(new LoginEvent(testUser));
         storage.gettingFolders().done(new Function() {
             public void f() {

Modified: james/hupa/trunk/hupa/pom.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/hupa/pom.xml?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/hupa/pom.xml (original)
+++ james/hupa/trunk/hupa/pom.xml Thu Mar 20 08:16:02 2014
@@ -102,16 +102,16 @@
         <dependency>
             <groupId>com.googlecode.gwtquery</groupId>
             <artifactId>gwtquery</artifactId>
-        </dependency>        
+        </dependency>
         <dependency>
             <groupId>javax.validation</groupId>
             <artifactId>validation-api</artifactId>
         </dependency>
-	    <dependency>
-	      <groupId>javax.validation</groupId>
-	      <artifactId>validation-api</artifactId>
-	      <classifier>sources</classifier>
-	    </dependency>
+        <dependency>
+          <groupId>javax.validation</groupId>
+          <artifactId>validation-api</artifactId>
+          <classifier>sources</classifier>
+        </dependency>
         <dependency>
             <groupId>org.hibernate</groupId>
             <artifactId>hibernate-validator</artifactId>

Modified: james/hupa/trunk/hupa/src/main/java/com/google/web/bindery/requestfactory/server/ResolverServiceLayer.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/hupa/src/main/java/com/google/web/bindery/requestfactory/server/ResolverServiceLayer.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/hupa/src/main/java/com/google/web/bindery/requestfactory/server/ResolverServiceLayer.java (original)
+++ james/hupa/trunk/hupa/src/main/java/com/google/web/bindery/requestfactory/server/ResolverServiceLayer.java Thu Mar 20 08:16:02 2014
@@ -1,12 +1,12 @@
 /*
  * Copyright 2010 Google Inc.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  * use this file except in compliance with the License. You may obtain a copy of
  * the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -76,7 +76,7 @@ final class ResolverServiceLayer extends
     if (TypeUtils.isValueType(domainClass)) {
       return domainClass.asSubclass(clientClass);
     }
-    
+
     List<Class<?>> classes = new ArrayList<Class<?>>();
     Class<?> clazz = domainClass;
     while (clazz != null) {
@@ -84,7 +84,7 @@ final class ResolverServiceLayer extends
       clazz = clazz.getSuperclass();
     }
     classes.addAll(Arrays.asList(domainClass.getInterfaces()));
-    
+
     for (Class<?> toSearch : classes) {
       List<String> clientTypes = deobfuscator.getClientProxies(toSearch.getName());
       if (clientTypes != null) {
@@ -96,7 +96,7 @@ final class ResolverServiceLayer extends
         }
       }
     }
-    
+
     if (required) {
       die(null, "The domain type %s cannot be sent to the client", domainClass.getCanonicalName());
     }

Modified: james/hupa/trunk/hupa/src/main/java/org/apache/hupa/HupaDev.gwt.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/hupa/src/main/java/org/apache/hupa/HupaDev.gwt.xml?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/hupa/src/main/java/org/apache/hupa/HupaDev.gwt.xml (original)
+++ james/hupa/trunk/hupa/src/main/java/org/apache/hupa/HupaDev.gwt.xml Thu Mar 20 08:16:02 2014
@@ -15,7 +15,7 @@
     License.
 -->
 <module rename-to='hupa'>
-  <inherits name='org.apache.hupa.Hupa'/> 
+  <inherits name='org.apache.hupa.Hupa'/>
 
   <!-- This reduces a lot the size of compiled javascript-->
   <set-property name="compiler.stackMode" value="emulated" />
@@ -25,6 +25,6 @@
   <set-property name="user.agent" value="gecko1_8,safari"/>
 
   <set-configuration-property name="CssResource.style" value="pretty"/>
-  
-  <entry-point class='org.apache.hupa.client.Hupa'/>  
+
+  <entry-point class='org.apache.hupa.client.Hupa'/>
 </module>

Modified: james/hupa/trunk/hupa/src/main/java/org/apache/hupa/HupaProd.gwt.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/hupa/src/main/java/org/apache/hupa/HupaProd.gwt.xml?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/hupa/src/main/java/org/apache/hupa/HupaProd.gwt.xml (original)
+++ james/hupa/trunk/hupa/src/main/java/org/apache/hupa/HupaProd.gwt.xml Thu Mar 20 08:16:02 2014
@@ -15,7 +15,7 @@
     License.
 -->
 <module rename-to='hupa'>
-  <inherits name='org.apache.hupa.Hupa'/> 
+  <inherits name='org.apache.hupa.Hupa'/>
 
   <!-- Provide gzipped version of generated js, so as it will sent compressed by jetty -->
   <inherits name="com.google.gwt.precompress.Precompress"/>
@@ -32,6 +32,6 @@
   <set-property name="user.agent" value="gecko1_8,safari,ie9"/>
 
   <set-configuration-property name="CssResource.style" value="obf"/>
-  
-  <entry-point class='org.apache.hupa.client.Hupa'/>  
+
+  <entry-point class='org.apache.hupa.client.Hupa'/>
 </module>

Modified: james/hupa/trunk/hupa/src/main/java/org/apache/hupa/client/Hupa.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/hupa/src/main/java/org/apache/hupa/client/Hupa.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/hupa/src/main/java/org/apache/hupa/client/Hupa.java (original)
+++ james/hupa/trunk/hupa/src/main/java/org/apache/hupa/client/Hupa.java Thu Mar 20 08:16:02 2014
@@ -30,34 +30,34 @@ import com.google.gwt.user.client.DOM;
 
 public class Hupa implements EntryPoint {
 
-	@Override
-	public void onModuleLoad() {
-		handleExceptionsAsync();
-		initApp();
-	}
-	
-	protected void initApp() {
+    @Override
+    public void onModuleLoad() {
+        handleExceptionsAsync();
+        initApp();
+    }
+
+    protected void initApp() {
         DOM.getElementById("loading").removeFromParent();
         createInjector().getHupaController();
         bindEvents();
-	}
-	
-	protected void bindEvents() {
-	}
+    }
 
-	protected AppInjector createInjector() {
+    protected void bindEvents() {
+    }
+
+    protected AppInjector createInjector() {
         return GWT.create(AppGinjector.class);
     }
 
-	protected void handleExceptionsAsync() {
-		GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
-			public void onUncaughtException(Throwable e) {
-				e.printStackTrace();
-				GQuery.console.log(stackTraceToString(e));
-			}
-		});
-	}
-	
+    protected void handleExceptionsAsync() {
+        GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
+            public void onUncaughtException(Throwable e) {
+                e.printStackTrace();
+                GQuery.console.log(stackTraceToString(e));
+            }
+        });
+    }
+
     private String stackTraceToString(Throwable throwable) {
         String ret = "";
         while (throwable != null) {

Modified: james/hupa/trunk/hupa/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/hupa/src/main/webapp/WEB-INF/web.xml?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/hupa/src/main/webapp/WEB-INF/web.xml (original)
+++ james/hupa/trunk/hupa/src/main/webapp/WEB-INF/web.xml Thu Mar 20 08:16:02 2014
@@ -15,18 +15,18 @@
     License.
 -->
 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
               http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
          version="2.5"
          xmlns="http://java.sun.com/xml/ns/javaee">
 
-	<!-- Max size of the upload request (10MB) -->
-	<context-param>
-		<param-name>maxSize</param-name>
-		<param-value>10485760</param-value>
-	</context-param>
-	
-	
+    <!-- Max size of the upload request (10MB) -->
+    <context-param>
+        <param-name>maxSize</param-name>
+        <param-value>10485760</param-value>
+    </context-param>
+
+
     <!-- Tell guice which injector to use -->
     <listener>
       <listener-class>org.apache.hupa.server.ioc.GuiceListener</listener-class>
@@ -49,5 +49,5 @@
         <welcome-file>Hupa.html</welcome-file>
         <welcome-file>hupa/Hupa.html</welcome-file>
     </welcome-file-list>
-    
+
 </web-app>

Modified: james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/guice/AbstractGuiceTestModule.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/guice/AbstractGuiceTestModule.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/guice/AbstractGuiceTestModule.java (original)
+++ james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/guice/AbstractGuiceTestModule.java Thu Mar 20 08:16:02 2014
@@ -31,12 +31,12 @@ import com.google.inject.name.Named;
 /**
  * Abstract Guice module.
  * Extend this class with your own, and set bindings to your need. E.g.
- * 
+ *
  * <pre>
  *   @Override
  *   protected void configureHandlers() {
  *       Names.bindProperties(binder(), properties);
- *       
+ *
  *       bind(Session.class).toProvider(sessionClass);
  *       bind(HttpSession.class).toProvider(MockHttpSessionProvider.class);
  *       bind(Settings.class).toProvider(settingsProviderClass).in(Singleton.class);
@@ -48,7 +48,7 @@ import com.google.inject.name.Named;
  *       bind(LoginUserHandler.class);
  *       bind(LogoutUserHandler.class);
  *       bind(IdleHandler.class);
- *       
+ *
  *       bind(FetchFoldersHandler.class);
  *       bind(CreateFolderHandler.class);
  *       bind(DeleteFolderHandler.class);
@@ -59,26 +59,26 @@ import com.google.inject.name.Named;
  *       bind(SendMessageHandler.class);
  *       bind(ReplyMessageHandler.class);
  *       bind(ForwardMessageHandler.class);
- *       
+ *
  *       bindHandler(Contacts.class, ContactsHandler.class);
  *       bindHandler(SendMessage.class, SendMessageHandler.class);
- *       
+ *
  *       bind(UserPreferencesStorage.class).to(userPreferencesClass);
- *       
+ *
  *       bind(User.class).to(TestUser.class).in(Singleton.class);
- *       
+ *
  *   }
  * </pre>
- * 
+ *
  * @author manolo
  *
  */
 public abstract class AbstractGuiceTestModule extends AbstractModule{
 
     protected static class TestUser extends UserImpl {
-    	
+
         @Inject
-        public TestUser(@Named("Username") String username, 
+        public TestUser(@Named("Username") String username,
                         @Named("Password") String password,
                         Settings settings) {
             setName(username);
@@ -86,8 +86,8 @@ public abstract class AbstractGuiceTestM
             setSettings(settings);
         }
     }
-    
-    
+
+
     /**
      * Configuration of a Apache-James server.
      * Customize it for your integration tests.
@@ -95,30 +95,30 @@ public abstract class AbstractGuiceTestM
     public static final Properties jamesProperties = new Properties() {
         private static final long serialVersionUID = 1L;
         {
-            // SET THIS 
+            // SET THIS
             put("Username","manolo");
             put("Password","***");
             ///
-            
+
             put("IMAPServerAddress", "localhost");
             put("IMAPServerPort", "143");
             put("IMAPS", "false");
-            
+
             put("DefaultInboxFolder", "INBOX");
             put("DefaultTrashFolder", "Trash");
             put("DefaultSentFolder", "Sent");
             put("DefaultDraftsFolder", "Drafts");
-            
+
             put("SMTPServerAddress", "localhost");
             put("SMTPServerPort", "25");
             put("SMTPS", "false");
             put("SMTPAuth", "true");
-            
+
             put("SessionDebug", "true");
             put("TrustSSL", "false");
         }
     };
-    
+
     /**
      * Configuration of an IMAP server.
      * Customize it for your integration tests.
@@ -126,58 +126,58 @@ public abstract class AbstractGuiceTestM
     public static final Properties courierProperties = new Properties() {
         private static final long serialVersionUID = 1L;
         {
-            // SET THIS 
+            // SET THIS
             put("Username","user");
             put("Password","password");
             ///
-            
+
             put("IMAPServerAddress", "localhost");
             put("IMAPServerPort", "143");
             put("IMAPS", "false");
-            
+
             put("DefaultInboxFolder", "INBOX");
             put("DefaultTrashFolder", "INBOX.Trash");
             put("DefaultSentFolder", "INBOX.Sent");
             put("DefaultDraftsFolder", "INBOX.Drafts");
-            
+
             put("SMTPServerAddress", "mail.hotelsearch.com");
             put("SMTPServerPort", "25");
             put("SMTPS", "false");
             put("SMTPAuth", "true");
-            
+
             put("SessionDebug", "true");
             put("TrustSSL", "false");
         }
     };
-    
+
     /**
      * Configuration of GMail IMAP server.
      */
     public static final Properties gmailProperties = new Properties() {
         private static final long serialVersionUID = 1L;
         {
-            // Use a valid gmail account 
+            // Use a valid gmail account
             put("Username","doodootis@gmail.com");
             put("Password","******");
             /////
-            
+
             put("IMAPServerAddress", "imap.gmail.com");
             put("IMAPServerPort", "993");
             put("IMAPS", "true");
-            
+
             put("IMAPConnectionPoolSize", "4");
             put("IMAPConnectionPoolTimeout", "300000");
-            
+
             put("DefaultInboxFolder", "INBOX");
             put("DefaultTrashFolder", "[Gmail]/Trash");
             put("DefaultSentFolder", "[Gmail]/Sent Mail");
             put("DefaultDraftsFolder", "[Gmail]/Drafts");
-            
+
             put("SMTPServerAddress", "smtp.gmail.com");
             put("SMTPServerPort", "465");
             put("SMTPS", "true");
             put("SMTPAuth", "true");
-            
+
             put("SessionDebug", "true");
             put("TrustSSL", "false");
         }

Modified: james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockConstants.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockConstants.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockConstants.java (original)
+++ james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockConstants.java Thu Mar 20 08:16:02 2014
@@ -30,9 +30,9 @@ import org.apache.hupa.shared.domain.Use
  * Constants and properties used for mock mode
  */
 public class MockConstants {
-    
+
     public static String SESSION_ID = "MockID";
-     
+
     public final static Settings mockSettings = new SettingsImpl() {
         {
             setInboxFolderName(MockIMAPStore.MOCK_INBOX_FOLDER);
@@ -48,7 +48,7 @@ public class MockConstants {
             setSmtpAuth(false);
         }
     };
-    
+
     public final static Properties mockProperties = new Properties() {
         private static final long serialVersionUID = 1L;
         {
@@ -57,14 +57,14 @@ public class MockConstants {
 
             put("IMAPServerAddress", MockIMAPStore.MOCK_HOST);
             put("SMTPServerAddress", MockIMAPStore.MOCK_HOST);
-            
+
             put("SessionDebug", "false");
-            
+
             put("DefaultInboxFolder", MockIMAPStore.MOCK_INBOX_FOLDER);
             put("DefaultTrashFolder", MockIMAPStore.MOCK_TRASH_FOLDER);
             put("DefaultSentFolder", MockIMAPStore.MOCK_SENT_FOLDER);
             put("DefaultDraftsFolder", MockIMAPStore.MOCK_DRAFTS_FOLDER);
-            
+
             put("PostFetchMessageCount", "0");
         }
     };

Modified: james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockHttpSession.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockHttpSession.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockHttpSession.java (original)
+++ james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockHttpSession.java Thu Mar 20 08:16:02 2014
@@ -1,134 +1,134 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-package org.apache.hupa.server.mock;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpSessionContext;
-
-import com.google.inject.Inject;
-
-@SuppressWarnings("deprecation")
-public class MockHttpSession implements HttpSession{
-    private Map<String,Object> attributeMap = new HashMap<String, Object>();
-    private Map<String,Object> valueMap = new HashMap<String, Object>();
-    private long cTime;
-    private String id;
-    private static int seq = 0;
-    
-    @Inject
-    public MockHttpSession() {
-        cTime = System.currentTimeMillis();
-        this.id = MockConstants.SESSION_ID + "-" + seq++;
-    }
-    
-    public Object getAttribute(String name) {
-        return attributeMap.get(name);
-    }
-
-    
-    @SuppressWarnings("rawtypes")
-	public Enumeration getAttributeNames() {
-        return new Enumeration() {
-            Iterator it = attributeMap.keySet().iterator();
-            public boolean hasMoreElements() {
-                return it.hasNext();
-            }
-
-            public Object nextElement() {
-                return it.next();
-            }
-            
-        };
-    }
-
-    public long getCreationTime() {
-        return cTime;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public long getLastAccessedTime() {
-        return 0;
-    }
-
-    public int getMaxInactiveInterval() {
-        return 0;
-    }
-
-    public ServletContext getServletContext() {
-        return null;
-    }
-
-    public HttpSessionContext getSessionContext() {
-        return null;
-    }
-
-    public Object getValue(String name) {
-        return valueMap.get(name);
-    }
-
-    public String[] getValueNames() {
-        List<String> names = new ArrayList<String>();
-        Iterator<String> it = valueMap.keySet().iterator();
-        while (it.hasNext()) {
-            names.add(it.next());
-        }
-        return names.toArray(new String[names.size()]);
-    }
-
-    public void invalidate() {
-    }
-
-    public boolean isNew() {
-        return false;
-    }
-
-    public void putValue(String name, Object value) {
-        valueMap.put(name, value);
-    }
-
-    public void removeAttribute(String name) {
-        attributeMap.remove(name);
-    }
-
-    public void removeValue(String name) {
-        valueMap.remove(name);
-    
-    }
-
-    public void setAttribute(String name, Object value) {
-        attributeMap.put(name, value);
-    }
-
-    public void setMaxInactiveInterval(int interval) {
-        // TODO Auto-generated method stub
-        
-    }
-
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.hupa.server.mock;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
+import com.google.inject.Inject;
+
+@SuppressWarnings("deprecation")
+public class MockHttpSession implements HttpSession{
+    private Map<String,Object> attributeMap = new HashMap<String, Object>();
+    private Map<String,Object> valueMap = new HashMap<String, Object>();
+    private long cTime;
+    private String id;
+    private static int seq = 0;
+
+    @Inject
+    public MockHttpSession() {
+        cTime = System.currentTimeMillis();
+        this.id = MockConstants.SESSION_ID + "-" + seq++;
+    }
+
+    public Object getAttribute(String name) {
+        return attributeMap.get(name);
+    }
+
+
+    @SuppressWarnings("rawtypes")
+    public Enumeration getAttributeNames() {
+        return new Enumeration() {
+            Iterator it = attributeMap.keySet().iterator();
+            public boolean hasMoreElements() {
+                return it.hasNext();
+            }
+
+            public Object nextElement() {
+                return it.next();
+            }
+
+        };
+    }
+
+    public long getCreationTime() {
+        return cTime;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public long getLastAccessedTime() {
+        return 0;
+    }
+
+    public int getMaxInactiveInterval() {
+        return 0;
+    }
+
+    public ServletContext getServletContext() {
+        return null;
+    }
+
+    public HttpSessionContext getSessionContext() {
+        return null;
+    }
+
+    public Object getValue(String name) {
+        return valueMap.get(name);
+    }
+
+    public String[] getValueNames() {
+        List<String> names = new ArrayList<String>();
+        Iterator<String> it = valueMap.keySet().iterator();
+        while (it.hasNext()) {
+            names.add(it.next());
+        }
+        return names.toArray(new String[names.size()]);
+    }
+
+    public void invalidate() {
+    }
+
+    public boolean isNew() {
+        return false;
+    }
+
+    public void putValue(String name, Object value) {
+        valueMap.put(name, value);
+    }
+
+    public void removeAttribute(String name) {
+        attributeMap.remove(name);
+    }
+
+    public void removeValue(String name) {
+        valueMap.remove(name);
+
+    }
+
+    public void setAttribute(String name, Object value) {
+        attributeMap.put(name, value);
+    }
+
+    public void setMaxInactiveInterval(int interval) {
+        // TODO Auto-generated method stub
+
+    }
+
+}

Modified: james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java (original)
+++ james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPFolder.java Thu Mar 20 08:16:02 2014
@@ -43,11 +43,11 @@ public class MockIMAPFolder extends IMAP
     public static final char SEPARATOR = '.';
     public static final String MOCK_DEFAULT_FOLDER = "";
     public static final String MOCK_MESSAGES_LOCATION = "mime/";
-    
+
     public List<Message> messages = new ArrayList<Message>();
     private boolean closed = true;
     private boolean exists;
-    
+
     public MockIMAPFolder(String fullName, IMAPStore store) {
         super(fullName, (MOCK_DEFAULT_FOLDER.equals(fullName) ? '\0' : SEPARATOR), store, false);
     }
@@ -59,7 +59,7 @@ public class MockIMAPFolder extends IMAP
         messages.addAll(Arrays.asList(mArray));
         return mArray;
     }
-    
+
     @Override
     public void appendMessages(Message[] msgs) throws MessagingException {
         addMessages(msgs);
@@ -87,7 +87,7 @@ public class MockIMAPFolder extends IMAP
         ((MockIMAPFolder) folder).addMessages(messages);
 
     }
-    
+
     public synchronized void loadDemoMessages(Session session) throws MessagingException {
         if (!exists()) {
             create(IMAPFolder.HOLDS_MESSAGES);
@@ -261,9 +261,9 @@ public class MockIMAPFolder extends IMAP
         checkExists();
         ArrayList<Message> ret = new ArrayList<Message>();
         for (Message m : messages) {
-        	if (search.match(m)) {
-        		ret.add(m);
-        	}
+            if (search.match(m)) {
+                ret.add(m);
+            }
         }
         return ret.toArray(new Message[0]);
     }
@@ -294,7 +294,7 @@ public class MockIMAPFolder extends IMAP
             throws MessagingException {
         checkExists();
         Message[] array = new Message[end- --start];
-        for (int i=0; start<end; i++,start++) 
+        for (int i=0; start<end; i++,start++)
             array[i] = messages.get(start);
         return array;
     }

Modified: james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPStore.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPStore.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPStore.java (original)
+++ james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPStore.java Thu Mar 20 08:16:02 2014
@@ -41,13 +41,13 @@ public class MockIMAPStore extends IMAPS
     public final static String MOCK_TRASH_FOLDER = "Mock-Trash";
     public final static String MOCK_DRAFTS_FOLDER = "Mock-Drafts";
     public static final String MOCK_HOST = "hupa.demo";
-	public final static String MOCK_LOGIN = "demo";
+    public final static String MOCK_LOGIN = "demo";
     private Map<String, String> validLogins = new HashMap<String, String>();
     private boolean connected = false;
     private List<MockIMAPFolder> folders = new ArrayList<MockIMAPFolder>();
     private List<String> capList;
     static final URLName demoUrl = new URLName(null, MOCK_HOST, 0, null, null, null);
-    
+
     /**
      * Default constructor, it creates the folder structure and loads messages for demo
      */
@@ -55,7 +55,7 @@ public class MockIMAPStore extends IMAPS
     public MockIMAPStore(Properties prop) {
         this(Session.getInstance(prop), demoUrl);
     }
-    
+
     public MockIMAPStore(Session ses) {
         this(ses, demoUrl);
     }
@@ -81,7 +81,7 @@ public class MockIMAPStore extends IMAPS
     public static Provider getProvider() {
         return new Provider(Provider.Type.STORE,"mockimap",MockIMAPStore.class.getName(),"","");
     }
-    
+
     public synchronized boolean save(MockIMAPFolder folder) {
         for (MockIMAPFolder iFolder : folders) {
             if (iFolder.getFullName().equals(folder.getFullName())) {
@@ -90,8 +90,8 @@ public class MockIMAPStore extends IMAPS
         }
         folders.add(folder);
         return true;
-    } 
-    
+    }
+
     public synchronized boolean delete(MockIMAPFolder folder, boolean recursive) {
         boolean found = false;
         for (int i= 0; i < folders.size(); i++) {
@@ -104,11 +104,11 @@ public class MockIMAPStore extends IMAPS
             } else if (folders.get(i).getFullName().startsWith(folder.getFullName() + MockIMAPFolder.SEPARATOR)) {
                 folders.remove(i);
             }
-            
+
         }
         return found;
-    } 
-    
+    }
+
     public MockIMAPFolder getParent(MockIMAPFolder folder) {
         for (MockIMAPFolder f : folders) {
             if ((f.getFullName() + MockIMAPFolder.SEPARATOR + folder.getName()).equals(folder.getFullName())) {
@@ -117,7 +117,7 @@ public class MockIMAPStore extends IMAPS
         }
         return null;
     }
-    
+
     public synchronized List<MockIMAPFolder> getChilds(MockIMAPFolder folder) {
         List<MockIMAPFolder> childs = new ArrayList<MockIMAPFolder>();
         if (MockIMAPFolder.MOCK_DEFAULT_FOLDER.equals(folder.getFullName())) {
@@ -131,13 +131,13 @@ public class MockIMAPStore extends IMAPS
                 if (f.getFullName().startsWith(
                         folder.getFullName() + MockIMAPFolder.SEPARATOR)) {
                     childs.add(f);
-                    
+
                 }
             }
         }
         return childs;
     }
-    
+
     public synchronized void setValidLogins(Map<String,String> validLogins) {
         this.validLogins = validLogins;
     }
@@ -145,7 +145,7 @@ public class MockIMAPStore extends IMAPS
     public synchronized void clear() {
         folders.clear();
     }
-    
+
     @Override
     public synchronized void close() throws MessagingException {
         connected = false;
@@ -199,7 +199,7 @@ public class MockIMAPStore extends IMAPS
         if (pass != null && validLogins.get(user).equals(password)) {
             connect();
             return;
-        } 
+        }
         throw new AuthenticationFailedException("Invalid login, remember user demo/demo");
     }
 
@@ -208,7 +208,7 @@ public class MockIMAPStore extends IMAPS
         if (capList == null) return false;
         return capList.contains(capability);
     }
-    
+
     public synchronized void setCapabilities(List<String> capList) {
         this.capList = capList;
     }

Modified: james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockLog.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockLog.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockLog.java (original)
+++ james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockLog.java Thu Mar 20 08:16:02 2014
@@ -1,123 +1,123 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.hupa.server.mock;
-
-import org.apache.commons.logging.Log;
-
-public class MockLog implements Log{
-
-    public void debug(Object arg0) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void debug(Object arg0, Throwable arg1) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void error(Object arg0) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void error(Object arg0, Throwable arg1) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void fatal(Object arg0) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void fatal(Object arg0, Throwable arg1) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void info(Object arg0) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public void info(Object arg0, Throwable arg1) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    public boolean isDebugEnabled() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    public boolean isErrorEnabled() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    public boolean isFatalEnabled() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    public boolean isInfoEnabled() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    public boolean isTraceEnabled() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    public boolean isWarnEnabled() {
-        // TODO Auto-generated method stub
-        return true;
-    }
-
-    public void trace(Object arg0) {
-        log(arg0);
-
-    }
-
-    public void trace(Object arg0, Throwable arg1) {
-        log(arg0);
-
-    }
-
-    public void warn(Object arg0) {
-        log(arg0);
-
-    }
-
-    public void warn(Object arg0, Throwable arg1) {
-        log(arg0);
-    }
-    
-    private void log(Object msg) {
-        if (msg != null) {
-            System.out.println(msg);
-        } else {
-            System.out.println("null-value");
-        }
-    }
-
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.hupa.server.mock;
+
+import org.apache.commons.logging.Log;
+
+public class MockLog implements Log{
+
+    public void debug(Object arg0) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void debug(Object arg0, Throwable arg1) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void error(Object arg0) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void error(Object arg0, Throwable arg1) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void fatal(Object arg0) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void fatal(Object arg0, Throwable arg1) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void info(Object arg0) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void info(Object arg0, Throwable arg1) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public boolean isDebugEnabled() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean isErrorEnabled() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean isFatalEnabled() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean isInfoEnabled() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean isTraceEnabled() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean isWarnEnabled() {
+        // TODO Auto-generated method stub
+        return true;
+    }
+
+    public void trace(Object arg0) {
+        log(arg0);
+
+    }
+
+    public void trace(Object arg0, Throwable arg1) {
+        log(arg0);
+
+    }
+
+    public void warn(Object arg0) {
+        log(arg0);
+
+    }
+
+    public void warn(Object arg0, Throwable arg1) {
+        log(arg0);
+    }
+
+    private void log(Object msg) {
+        if (msg != null) {
+            System.out.println(msg);
+        } else {
+            System.out.println("null-value");
+        }
+    }
+
+}

Modified: james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockLogProvider.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockLogProvider.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockLogProvider.java (original)
+++ james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockLogProvider.java Thu Mar 20 08:16:02 2014
@@ -1,33 +1,33 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-
-package org.apache.hupa.server.mock;
-
-import org.apache.commons.logging.Log;
-
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-
-@Singleton
-public class MockLogProvider implements Provider<Log>{
-    public Log get() {
-        return new MockLog();
-    }
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+
+package org.apache.hupa.server.mock;
+
+import org.apache.commons.logging.Log;
+
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
+@Singleton
+public class MockLogProvider implements Provider<Log>{
+    public Log get() {
+        return new MockLog();
+    }
+}

Modified: james/hupa/trunk/server/pom.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/pom.xml?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/pom.xml (original)
+++ james/hupa/trunk/server/pom.xml Thu Mar 20 08:16:02 2014
@@ -145,7 +145,7 @@
                     </goals>
                     </execution>
                 </executions>
-            </plugin>            
+            </plugin>
         </plugins>
     </build>
 </project>

Modified: james/hupa/trunk/server/src/main/java/com/google/web/bindery/requestfactory/server/ResolverServiceLayer.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/com/google/web/bindery/requestfactory/server/ResolverServiceLayer.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/com/google/web/bindery/requestfactory/server/ResolverServiceLayer.java (original)
+++ james/hupa/trunk/server/src/main/java/com/google/web/bindery/requestfactory/server/ResolverServiceLayer.java Thu Mar 20 08:16:02 2014
@@ -1,12 +1,12 @@
 /*
  * Copyright 2010 Google Inc.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  * use this file except in compliance with the License. You may obtain a copy of
  * the License at
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -76,7 +76,7 @@ final class ResolverServiceLayer extends
     if (TypeUtils.isValueType(domainClass)) {
       return domainClass.asSubclass(clientClass);
     }
-    
+
     List<Class<?>> classes = new ArrayList<Class<?>>();
     Class<?> clazz = domainClass;
     while (clazz != null) {
@@ -84,7 +84,7 @@ final class ResolverServiceLayer extends
       clazz = clazz.getSuperclass();
     }
     classes.addAll(Arrays.asList(domainClass.getInterfaces()));
-    
+
     for (Class<?> toSearch : classes) {
       List<String> clientTypes = deobfuscator.getClientProxies(toSearch.getName());
       if (clientTypes != null) {
@@ -96,7 +96,7 @@ final class ResolverServiceLayer extends
         }
       }
     }
-    
+
     if (required) {
       die(null, "The domain type %s cannot be sent to the client", domainClass.getCanonicalName());
     }

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/CachedIMAPStore.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/CachedIMAPStore.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/CachedIMAPStore.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/CachedIMAPStore.java Thu Mar 20 08:16:02 2014
@@ -32,7 +32,7 @@ public class CachedIMAPStore {
 
     private CachedIMAPStore() {
     }
-    
+
     public static CachedIMAPStore getInstance() {
         return new CachedIMAPStore();
     }
@@ -57,12 +57,12 @@ public class CachedIMAPStore {
     public IMAPStore getStore() {
         return store;
     }
-    
+
     public Session getSession() {
         return session;
     }
 
     public void setSession(Session session) {
         this.session = session;
-    }    
+    }
 }
\ No newline at end of file

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/FileItemRegistry.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/FileItemRegistry.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/FileItemRegistry.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/FileItemRegistry.java Thu Mar 20 08:16:02 2014
@@ -34,27 +34,27 @@ public class FileItemRegistry {
     private Log logger;
     static int idCounter = 0;
     int registryId;
-    
+
     public String toString() {
         return "registryId=" + registryId +
                " nItems=" + map.size();
     }
-    
+
     @Inject
     public FileItemRegistry(Log logger) {
         this.logger = logger;
         registryId  = idCounter++;
     }
-    
+
     public void add(FileItem item) {
         logger.debug("Store item " + item.getName() + " with name " + item.getFieldName());
         map.put(item.getFieldName(), item);
     }
-    
+
     public void remove(String name) {
         remove(get(name));
     }
-    
+
     public void remove(FileItem item) {
         if (item != null) {
             logger.debug("Remove item " + item.getName() + " with name " + item.getFieldName());
@@ -63,17 +63,17 @@ public class FileItemRegistry {
             item.delete();
         }
     }
-    
+
     public void clear() {
-        for (Entry<String,FileItem> e: map.entrySet()) 
+        for (Entry<String,FileItem> e: map.entrySet())
             remove(e.getValue());
     }
-    
+
     public FileItem get(String name) {
         logger.debug("Retrieve item " + name + " isNull=" + (map.get(name) == null));
         return map.get(name);
     }
-    
+
     public int size() {
         return map.size();
     }

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/IMAPStoreCache.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/IMAPStoreCache.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/IMAPStoreCache.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/IMAPStoreCache.java Thu Mar 20 08:16:02 2014
@@ -1,36 +1,36 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.hupa.server;
-
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Session;
-
-import org.apache.hupa.shared.domain.User;
-
-import com.sun.mail.imap.IMAPStore;
-
-public interface IMAPStoreCache {
-    void delete(String username);
-    void delete(User user);
-    IMAPStore get(User user) throws MessagingException;
-    Session getMailSession(User user);
-    void sendMessage(Message msg) throws MessagingException;
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.hupa.server;
+
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Session;
+
+import org.apache.hupa.shared.domain.User;
+
+import com.sun.mail.imap.IMAPStore;
+
+public interface IMAPStoreCache {
+    void delete(String username);
+    void delete(User user);
+    IMAPStore get(User user) throws MessagingException;
+    Session getMailSession(User user);
+    void sendMessage(Message msg) throws MessagingException;
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java Thu Mar 20 08:16:02 2014
@@ -1,275 +1,275 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.hupa.server;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.mail.Authenticator;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.NoSuchProviderException;
-import javax.mail.PasswordAuthentication;
-import javax.mail.Session;
-import javax.mail.Transport;
-
-import org.apache.commons.logging.Log;
-import org.apache.hupa.shared.domain.Settings;
-import org.apache.hupa.shared.domain.User;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.name.Named;
-import com.sun.mail.iap.ProtocolException;
-import com.sun.mail.imap.IMAPFolder;
-import com.sun.mail.imap.IMAPFolder.ProtocolCommand;
-import com.sun.mail.imap.IMAPStore;
-import com.sun.mail.imap.protocol.IMAPProtocol;
-import com.sun.mail.imap.protocol.ListInfo;
-
-@Singleton
-public class InMemoryIMAPStoreCache implements IMAPStoreCache {
-
-    private final Map<String, CachedIMAPStore> pool = new HashMap<String, CachedIMAPStore>();
-    
-    private Log logger;
-    private int connectionPoolSize;
-    private int timeout;
-    private boolean debug;
-    private boolean trustSSL;
-    
-    @Inject
-    public InMemoryIMAPStoreCache(
-            Log logger, 
-            @Named("IMAPConnectionPoolSize") int connectionPoolSize, 
-            @Named("IMAPConnectionPoolTimeout") int timeout, 
-            @Named("SessionDebug") boolean debug, 
-            @Named("TrustStore") String truststore, 
-            @Named("TrustStorePassword") String truststorePassword,
-            @Named("TrustSSL") boolean trustSSL)
-    {
-        this.logger = logger;
-        this.connectionPoolSize = connectionPoolSize;
-        this.timeout = timeout;
-        this.debug = debug;
-        this.trustSSL = trustSSL;
-        if (!truststore.isEmpty()) {
-            System.setProperty("javax.net.ssl.trustStore", truststore);
-        }
-        if (!truststorePassword.isEmpty()) {
-            System.setProperty("javax.net.ssl.trustStorePassword", truststorePassword);
-        }
-        System.setProperty("mail.mime.decodetext.strict", "false");
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.apache.hupa.server.IMAPStoreCache#get(org.apache.hupa.shared.data.User)
-     */
-    public IMAPStore get(User user) throws MessagingException {
-        // FIXME, there will be a NullPointerException thrown here when user session expired
-        
-        String id = user.getId();
-        String username = user.getName();
-        String password = user.getPassword();
-        Settings settings = user.getSettings();
-
-        CachedIMAPStore cstore = pool.get(username);
-        if (cstore == null) {
-            logger.debug("No cached store found for user " +username);
-        } else {
-            if (cstore.isExpired() == false) {
-                try {
-                    cstore.validate();
-                } catch (MessagingException e) {
-                }
-            } else {
-                pool.remove(username);
-                try {
-                    cstore.getStore().close();
-                    cstore = null;
-                } catch (MessagingException e) {
-                }
-            }
-        }
-        
-        if (cstore == null) {
-            cstore = createCachedIMAPStore(user);
-        }
-        
-        if (cstore.getStore().isConnected() == false) {
-            cstore.getStore().connect(settings.getImapServer(), settings.getImapPort(), id, password);
-        }
-
-        pool.put(username, cstore);
-        IMAPStore ret = cstore.getStore();
-
-        // TODO: this is a hack for gmail
-        if (settings.getImapServer().contains("gmail.com")) {
-            internationalizeGmailFolders(user, ret); 
-        }
-        
-        return ret;
-    }
-    
-    public void internationalizeGmailFolders(User user, IMAPStore store) {
-        // TODO: this is a hack, we should have a default domain suffix in configuration files
-        if (!user.getName().contains("@")) {
-            user.setName(user.getName() + "@gmail.com");
-        }
-        try {
-            final IMAPFolder folder = (IMAPFolder) store.getDefaultFolder();
-            final char c = folder.getSeparator();
-
-            ListInfo[] li = (ListInfo[])folder.doCommandIgnoreFailure(new ProtocolCommand() {
-                                public Object doCommand(IMAPProtocol p) throws ProtocolException {
-                                    String arg = folder.getFullName() + c + "*";
-                                    return p.lsub("", arg);
-                                }
-                            });
-            
-            for (ListInfo l : li) {
-                if (l.attrs != null && l.attrs.length > 1) {
-                    // * LIST (\HasNoChildren \Drafts) "/" "[Gmail]/Borradores"
-                    String n = l.attrs[1];
-                    if ("\\Drafts".equals(n)) {
-                        user.getSettings().setDraftsFolderName(l.name);
-                    } else if ("\\Sent".equals(n)) {
-                        user.getSettings().setSentFolderName(l.name);
-                    } else if ("\\Trash".equals(n)) {
-                        user.getSettings().setTrashFolderName(l.name);
-                    } else if ("\\Junk".equals(n)) {
-                    }
-                }
-            }
-        } catch (Exception e) {
-        }
-    }
-    
-    public CachedIMAPStore createCachedIMAPStore(User user) throws NoSuchProviderException {
-        Session ses = createSession(user);
-        IMAPStore store = (IMAPStore)ses.getStore(user.getSettings().getImapSecure() ? "imaps" : "imap");
-        CachedIMAPStore ret = new CachedIMAPStore(store, 300);
-        ret.setSession(ses);
-        return ret;
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.apache.hupa.server.IMAPStoreCache#delete(org.apache.hupa.shared.data.User)
-     */
-    public synchronized void delete(User user) {
-        delete(user.getName());
-    }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.apache.hupa.server.IMAPStoreCache#delete(java.lang.String)
-     */
-    public synchronized void delete(String username) {
-        CachedIMAPStore cstore = pool.get(username);
-        if (cstore != null && cstore.getStore().isConnected()) {
-            try {
-                cstore.getStore().close();
-            } catch (MessagingException e) {
-                // Ignore on close
-            }
-        }
-        pool.remove(username);
-    }
-
-    public void sendMessage(Message msg) throws MessagingException {
-        Transport.send(msg);
-    }
-
-    public Session getMailSession(User user) {
-        CachedIMAPStore cstore = pool.get(user.getName());
-        return cstore.getSession();
-    }
-    
-    private Session createSession(final User user) {
-        Properties props = new Properties();
-        Settings settings = user.getSettings();
-
-        props.setProperty("mail.mime.decodetext.strict", "false");
-        if (settings.getImapSecure()) {
-            props.setProperty("mail.store.protocol", "imaps");
-            props.setProperty("mail.imaps.connectionpoolsize", connectionPoolSize + "");
-            props.setProperty("mail.imaps.connectionpooltimeout", timeout + "");
-            if (trustSSL) {
-                props.setProperty("mail.imaps.ssl.trust", settings.getImapServer());
-            }
-        } else {
-            props.setProperty("mail.imap.connectionpoolsize", connectionPoolSize + "");
-            props.setProperty("mail.imap.connectionpooltimeout", timeout + "");
-        }
-        
-        if (settings.getSmtpSecure()) {
-            if (settings.getSmtpPort() == 587) {
-                props.setProperty("mail.smtp.starttls.enable", "true");
-                props.setProperty("mail.transport.protocol.rfc822", "smtp");
-            } else {
-                props.setProperty("mail.transport.protocol.rfc822", "smtps");
-                props.setProperty("mail.smtps.ssl.enable", "true");
-                if (trustSSL) {
-                    props.setProperty("mail.smtps.ssl.trust", settings.getSmtpServer());
-                }
-            }
-        } else {
-            props.setProperty("mail.transport.protocol.rfc822", "smtp");
-        }
-
-        props.setProperty("mail.smtp.host", settings.getSmtpServer());
-        props.setProperty("mail.smtps.host", settings.getSmtpServer());
-        props.setProperty("mail.smtp.port", settings.getSmtpPort() + "");
-        props.setProperty("mail.smtps.port", settings.getSmtpPort() + "");
-
-        Authenticator auth = null;
-        if (settings.getSmtpAuth() && user.getPassword() != null && user.getName() != null) {
-            props.setProperty("mail.smtp.auth", "true");
-            props.setProperty("mail.smtps.auth", "true");
-            auth = new javax.mail.Authenticator() {
-                protected PasswordAuthentication getPasswordAuthentication() {
-                    String userId = user.getId();
-                    StackTraceElement[] sElms = Thread.currentThread().getStackTrace();
-                    for (StackTraceElement e : sElms) {
-                        if (e.getClassName().equals(InMemoryIMAPStoreCache.class.getName()) && e.getMethodName().equals("get")) {
-                            // We try with the id part the second time (unix imap/smtp auth compatible)
-                            if (userId.matches(".*@.*")) {
-                                userId = userId.replaceFirst("@.*", "");
-                                user.setId(userId);
-                                break;
-                            } else {
-                                return null;
-                            }
-                        }
-                    }
-                    return new PasswordAuthentication(userId, user.getPassword());
-                }
-            };
-        }
-        
-        Session ses = Session.getInstance(props, auth);
-        ses.setDebug(debug && logger.isDebugEnabled());
-        logger.debug("Created session " + user.getName() + "\n" + settings + "\n"+ props.toString().replaceAll(",", ",\n "));
-        return ses;
-    }
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.hupa.server;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.mail.Authenticator;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.NoSuchProviderException;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.Transport;
+
+import org.apache.commons.logging.Log;
+import org.apache.hupa.shared.domain.Settings;
+import org.apache.hupa.shared.domain.User;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.name.Named;
+import com.sun.mail.iap.ProtocolException;
+import com.sun.mail.imap.IMAPFolder;
+import com.sun.mail.imap.IMAPFolder.ProtocolCommand;
+import com.sun.mail.imap.IMAPStore;
+import com.sun.mail.imap.protocol.IMAPProtocol;
+import com.sun.mail.imap.protocol.ListInfo;
+
+@Singleton
+public class InMemoryIMAPStoreCache implements IMAPStoreCache {
+
+    private final Map<String, CachedIMAPStore> pool = new HashMap<String, CachedIMAPStore>();
+
+    private Log logger;
+    private int connectionPoolSize;
+    private int timeout;
+    private boolean debug;
+    private boolean trustSSL;
+
+    @Inject
+    public InMemoryIMAPStoreCache(
+            Log logger,
+            @Named("IMAPConnectionPoolSize") int connectionPoolSize,
+            @Named("IMAPConnectionPoolTimeout") int timeout,
+            @Named("SessionDebug") boolean debug,
+            @Named("TrustStore") String truststore,
+            @Named("TrustStorePassword") String truststorePassword,
+            @Named("TrustSSL") boolean trustSSL)
+    {
+        this.logger = logger;
+        this.connectionPoolSize = connectionPoolSize;
+        this.timeout = timeout;
+        this.debug = debug;
+        this.trustSSL = trustSSL;
+        if (!truststore.isEmpty()) {
+            System.setProperty("javax.net.ssl.trustStore", truststore);
+        }
+        if (!truststorePassword.isEmpty()) {
+            System.setProperty("javax.net.ssl.trustStorePassword", truststorePassword);
+        }
+        System.setProperty("mail.mime.decodetext.strict", "false");
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.hupa.server.IMAPStoreCache#get(org.apache.hupa.shared.data.User)
+     */
+    public IMAPStore get(User user) throws MessagingException {
+        // FIXME, there will be a NullPointerException thrown here when user session expired
+
+        String id = user.getId();
+        String username = user.getName();
+        String password = user.getPassword();
+        Settings settings = user.getSettings();
+
+        CachedIMAPStore cstore = pool.get(username);
+        if (cstore == null) {
+            logger.debug("No cached store found for user " +username);
+        } else {
+            if (cstore.isExpired() == false) {
+                try {
+                    cstore.validate();
+                } catch (MessagingException e) {
+                }
+            } else {
+                pool.remove(username);
+                try {
+                    cstore.getStore().close();
+                    cstore = null;
+                } catch (MessagingException e) {
+                }
+            }
+        }
+
+        if (cstore == null) {
+            cstore = createCachedIMAPStore(user);
+        }
+
+        if (cstore.getStore().isConnected() == false) {
+            cstore.getStore().connect(settings.getImapServer(), settings.getImapPort(), id, password);
+        }
+
+        pool.put(username, cstore);
+        IMAPStore ret = cstore.getStore();
+
+        // TODO: this is a hack for gmail
+        if (settings.getImapServer().contains("gmail.com")) {
+            internationalizeGmailFolders(user, ret);
+        }
+
+        return ret;
+    }
+
+    public void internationalizeGmailFolders(User user, IMAPStore store) {
+        // TODO: this is a hack, we should have a default domain suffix in configuration files
+        if (!user.getName().contains("@")) {
+            user.setName(user.getName() + "@gmail.com");
+        }
+        try {
+            final IMAPFolder folder = (IMAPFolder) store.getDefaultFolder();
+            final char c = folder.getSeparator();
+
+            ListInfo[] li = (ListInfo[])folder.doCommandIgnoreFailure(new ProtocolCommand() {
+                                public Object doCommand(IMAPProtocol p) throws ProtocolException {
+                                    String arg = folder.getFullName() + c + "*";
+                                    return p.lsub("", arg);
+                                }
+                            });
+
+            for (ListInfo l : li) {
+                if (l.attrs != null && l.attrs.length > 1) {
+                    // * LIST (\HasNoChildren \Drafts) "/" "[Gmail]/Borradores"
+                    String n = l.attrs[1];
+                    if ("\\Drafts".equals(n)) {
+                        user.getSettings().setDraftsFolderName(l.name);
+                    } else if ("\\Sent".equals(n)) {
+                        user.getSettings().setSentFolderName(l.name);
+                    } else if ("\\Trash".equals(n)) {
+                        user.getSettings().setTrashFolderName(l.name);
+                    } else if ("\\Junk".equals(n)) {
+                    }
+                }
+            }
+        } catch (Exception e) {
+        }
+    }
+
+    public CachedIMAPStore createCachedIMAPStore(User user) throws NoSuchProviderException {
+        Session ses = createSession(user);
+        IMAPStore store = (IMAPStore)ses.getStore(user.getSettings().getImapSecure() ? "imaps" : "imap");
+        CachedIMAPStore ret = new CachedIMAPStore(store, 300);
+        ret.setSession(ses);
+        return ret;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.hupa.server.IMAPStoreCache#delete(org.apache.hupa.shared.data.User)
+     */
+    public synchronized void delete(User user) {
+        delete(user.getName());
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.hupa.server.IMAPStoreCache#delete(java.lang.String)
+     */
+    public synchronized void delete(String username) {
+        CachedIMAPStore cstore = pool.get(username);
+        if (cstore != null && cstore.getStore().isConnected()) {
+            try {
+                cstore.getStore().close();
+            } catch (MessagingException e) {
+                // Ignore on close
+            }
+        }
+        pool.remove(username);
+    }
+
+    public void sendMessage(Message msg) throws MessagingException {
+        Transport.send(msg);
+    }
+
+    public Session getMailSession(User user) {
+        CachedIMAPStore cstore = pool.get(user.getName());
+        return cstore.getSession();
+    }
+
+    private Session createSession(final User user) {
+        Properties props = new Properties();
+        Settings settings = user.getSettings();
+
+        props.setProperty("mail.mime.decodetext.strict", "false");
+        if (settings.getImapSecure()) {
+            props.setProperty("mail.store.protocol", "imaps");
+            props.setProperty("mail.imaps.connectionpoolsize", connectionPoolSize + "");
+            props.setProperty("mail.imaps.connectionpooltimeout", timeout + "");
+            if (trustSSL) {
+                props.setProperty("mail.imaps.ssl.trust", settings.getImapServer());
+            }
+        } else {
+            props.setProperty("mail.imap.connectionpoolsize", connectionPoolSize + "");
+            props.setProperty("mail.imap.connectionpooltimeout", timeout + "");
+        }
+
+        if (settings.getSmtpSecure()) {
+            if (settings.getSmtpPort() == 587) {
+                props.setProperty("mail.smtp.starttls.enable", "true");
+                props.setProperty("mail.transport.protocol.rfc822", "smtp");
+            } else {
+                props.setProperty("mail.transport.protocol.rfc822", "smtps");
+                props.setProperty("mail.smtps.ssl.enable", "true");
+                if (trustSSL) {
+                    props.setProperty("mail.smtps.ssl.trust", settings.getSmtpServer());
+                }
+            }
+        } else {
+            props.setProperty("mail.transport.protocol.rfc822", "smtp");
+        }
+
+        props.setProperty("mail.smtp.host", settings.getSmtpServer());
+        props.setProperty("mail.smtps.host", settings.getSmtpServer());
+        props.setProperty("mail.smtp.port", settings.getSmtpPort() + "");
+        props.setProperty("mail.smtps.port", settings.getSmtpPort() + "");
+
+        Authenticator auth = null;
+        if (settings.getSmtpAuth() && user.getPassword() != null && user.getName() != null) {
+            props.setProperty("mail.smtp.auth", "true");
+            props.setProperty("mail.smtps.auth", "true");
+            auth = new javax.mail.Authenticator() {
+                protected PasswordAuthentication getPasswordAuthentication() {
+                    String userId = user.getId();
+                    StackTraceElement[] sElms = Thread.currentThread().getStackTrace();
+                    for (StackTraceElement e : sElms) {
+                        if (e.getClassName().equals(InMemoryIMAPStoreCache.class.getName()) && e.getMethodName().equals("get")) {
+                            // We try with the id part the second time (unix imap/smtp auth compatible)
+                            if (userId.matches(".*@.*")) {
+                                userId = userId.replaceFirst("@.*", "");
+                                user.setId(userId);
+                                break;
+                            } else {
+                                return null;
+                            }
+                        }
+                    }
+                    return new PasswordAuthentication(userId, user.getPassword());
+                }
+            };
+        }
+
+        Session ses = Session.getInstance(props, auth);
+        ses.setDebug(debug && logger.isDebugEnabled());
+        logger.debug("Created session " + user.getName() + "\n" + settings + "\n"+ props.toString().replaceAll(",", ",\n "));
+        return ses;
+    }
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/DefaultUserSettingsProvider.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/DefaultUserSettingsProvider.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/DefaultUserSettingsProvider.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/DefaultUserSettingsProvider.java Thu Mar 20 08:16:02 2014
@@ -27,20 +27,20 @@ import com.google.inject.Provider;
 import com.google.inject.name.Named;
 
 public class DefaultUserSettingsProvider implements Provider<Settings> {
-    
-    @Inject @Named("DefaultInboxFolder") private String inboxFolder; 
-    @Inject @Named("DefaultSentFolder") private String sentFolder; 
-    @Inject @Named("DefaultTrashFolder") private String trashFolder; 
-    @Inject @Named("DefaultDraftsFolder") private String draftFolder; 
-    @Inject @Named("PostFetchMessageCount") private int postCount; 
+
+    @Inject @Named("DefaultInboxFolder") private String inboxFolder;
+    @Inject @Named("DefaultSentFolder") private String sentFolder;
+    @Inject @Named("DefaultTrashFolder") private String trashFolder;
+    @Inject @Named("DefaultDraftsFolder") private String draftFolder;
+    @Inject @Named("PostFetchMessageCount") private int postCount;
     @Inject @Named("IMAPServerAddress") private String imapAddress;
-    @Inject @Named("IMAPServerPort") private int imapPort; 
+    @Inject @Named("IMAPServerPort") private int imapPort;
     @Inject @Named("IMAPS") private boolean imapSSL;
     @Inject @Named("SMTPServerAddress") private String smtpAddress;
     @Inject @Named("SMTPServerPort") private int smtpPort;
-    @Inject @Named("SMTPS") private boolean smtpSSL;            
+    @Inject @Named("SMTPS") private boolean smtpSSL;
     @Inject @Named("SMTPAuth") private boolean smtpAuth;
-    
+
     /*
      * (non-Javadoc)
      * @see com.google.inject.Provider#get()

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/HttpSessionProvider.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/HttpSessionProvider.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/HttpSessionProvider.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/HttpSessionProvider.java Thu Mar 20 08:16:02 2014
@@ -1,35 +1,35 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.hupa.server.guice.providers;
-
-
-import javax.servlet.http.HttpSession;
-
-import com.google.inject.Provider;
-import com.google.web.bindery.requestfactory.server.RequestFactoryServlet;
-
-public class HttpSessionProvider implements Provider<HttpSession>{
-
-	@Override
-    public HttpSession get() {
-		return RequestFactoryServlet.getThreadLocalRequest().getSession();
-    }
-
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.hupa.server.guice.providers;
+
+
+import javax.servlet.http.HttpSession;
+
+import com.google.inject.Provider;
+import com.google.web.bindery.requestfactory.server.RequestFactoryServlet;
+
+public class HttpSessionProvider implements Provider<HttpSession>{
+
+    @Override
+    public HttpSession get() {
+        return RequestFactoryServlet.getThreadLocalRequest().getSession();
+    }
+
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/LogProvider.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/LogProvider.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/LogProvider.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/LogProvider.java Thu Mar 20 08:16:02 2014
@@ -1,35 +1,35 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.hupa.server.guice.providers;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.impl.Log4JLogger;
-
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-
-@Singleton
-public class LogProvider implements Provider<Log>{
-
-    public Log get() {
-        return new Log4JLogger("HupaLogger");
-    }
-
-}
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.hupa.server.guice.providers;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.impl.Log4JLogger;
+
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
+@Singleton
+public class LogProvider implements Provider<Log>{
+
+    public Log get() {
+        return new Log4JLogger("HupaLogger");
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org