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 [14/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/server/src/main/java/org/apache/hupa/server/service/GetMessageRawService.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/GetMessageRawService.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/GetMessageRawService.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/GetMessageRawService.java Thu Mar 20 08:16:02 2014
@@ -1,29 +1,29 @@
-/****************************************************************
- * 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.service;
-
-import org.apache.hupa.shared.domain.GetMessageRawAction;
-import org.apache.hupa.shared.domain.GetMessageRawResult;
-
-public interface GetMessageRawService {
-
-    GetMessageRawResult get(GetMessageRawAction action) throws Exception;
-
-}
+/****************************************************************
+ * 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.service;
+
+import org.apache.hupa.shared.domain.GetMessageRawAction;
+import org.apache.hupa.shared.domain.GetMessageRawResult;
+
+public interface GetMessageRawService {
+
+    GetMessageRawResult get(GetMessageRawAction action) throws Exception;
+
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/GetMessageRawServiceImpl.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/GetMessageRawServiceImpl.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/GetMessageRawServiceImpl.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/GetMessageRawServiceImpl.java Thu Mar 20 08:16:02 2014
@@ -1,65 +1,65 @@
-/****************************************************************
- * 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.service;
-
-import java.io.ByteArrayOutputStream;
-
-import javax.mail.Folder;
-import javax.mail.Message;
-
-import org.apache.hupa.shared.data.GetMessageRawResultImpl;
-import org.apache.hupa.shared.domain.GetMessageRawAction;
-import org.apache.hupa.shared.domain.GetMessageRawResult;
-import org.apache.hupa.shared.domain.ImapFolder;
-import org.apache.hupa.shared.domain.User;
-
-import com.sun.mail.imap.IMAPFolder;
-import com.sun.mail.imap.IMAPStore;
-
-public class GetMessageRawServiceImpl extends AbstractService implements GetMessageRawService {
-
-    @Override
-    public GetMessageRawResult get(GetMessageRawAction action) throws Exception {
-        User user = getUser();
-        long uid = action.getUid();
-        ImapFolder folder = action.getFolder();
-        try {
-            IMAPStore store = cache.get(user);
-            IMAPFolder f = (IMAPFolder) store.getFolder(folder.getFullName());
-            if (f.isOpen() == false) {
-                f.open(Folder.READ_ONLY);
-            }
-            Message m = f.getMessageByUID(action.getUid());
-
-            ByteArrayOutputStream out = new ByteArrayOutputStream();
-            m.writeTo(out);
-            if (f.isOpen()) {
-                f.close(false);
-            }
-            return new GetMessageRawResultImpl(out.toString());
-        } catch (Exception e) {
-            logger.error("Unable to get raw content of msg for user " + user + " in folder " + folder + " with uid "
-                    + uid, e);
-            throw new Exception("Unable to et raw content of msg for user " + user + " in folder " + folder
-                    + " with uid " + uid);
-        }
-
-    }
-}
+/****************************************************************
+ * 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.service;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.mail.Folder;
+import javax.mail.Message;
+
+import org.apache.hupa.shared.data.GetMessageRawResultImpl;
+import org.apache.hupa.shared.domain.GetMessageRawAction;
+import org.apache.hupa.shared.domain.GetMessageRawResult;
+import org.apache.hupa.shared.domain.ImapFolder;
+import org.apache.hupa.shared.domain.User;
+
+import com.sun.mail.imap.IMAPFolder;
+import com.sun.mail.imap.IMAPStore;
+
+public class GetMessageRawServiceImpl extends AbstractService implements GetMessageRawService {
+
+    @Override
+    public GetMessageRawResult get(GetMessageRawAction action) throws Exception {
+        User user = getUser();
+        long uid = action.getUid();
+        ImapFolder folder = action.getFolder();
+        try {
+            IMAPStore store = cache.get(user);
+            IMAPFolder f = (IMAPFolder) store.getFolder(folder.getFullName());
+            if (f.isOpen() == false) {
+                f.open(Folder.READ_ONLY);
+            }
+            Message m = f.getMessageByUID(action.getUid());
+
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            m.writeTo(out);
+            if (f.isOpen()) {
+                f.close(false);
+            }
+            return new GetMessageRawResultImpl(out.toString());
+        } catch (Exception e) {
+            logger.error("Unable to get raw content of msg for user " + user + " in folder " + folder + " with uid "
+                    + uid, e);
+            throw new Exception("Unable to et raw content of msg for user " + user + " in folder " + folder
+                    + " with uid " + uid);
+        }
+
+    }
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/ImapFolderService.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/ImapFolderService.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/ImapFolderService.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/ImapFolderService.java Thu Mar 20 08:16:02 2014
@@ -1,28 +1,28 @@
-/****************************************************************
- * 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.service;
-
-import java.util.List;
-
-import org.apache.hupa.shared.domain.ImapFolder;
-
-public interface ImapFolderService {
-    List<ImapFolder> requestFolders() throws Exception;
-}
+/****************************************************************
+ * 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.service;
+
+import java.util.List;
+
+import org.apache.hupa.shared.domain.ImapFolder;
+
+public interface ImapFolderService {
+    List<ImapFolder> requestFolders() throws Exception;
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/ImapFolderServiceImpl.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/ImapFolderServiceImpl.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/ImapFolderServiceImpl.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/ImapFolderServiceImpl.java Thu Mar 20 08:16:02 2014
@@ -39,8 +39,8 @@ public class ImapFolderServiceImpl exten
         try {
             IMAPStore store = cache.get(user);
             com.sun.mail.imap.IMAPFolder folder = (com.sun.mail.imap.IMAPFolder) store.getDefaultFolder();
-            
-            // List of mail 'root' imap folders 
+
+            // List of mail 'root' imap folders
             List<ImapFolder> imapFolders = new ArrayList<ImapFolder>();
             // Create IMAPFolder tree list
             for (Folder f : folder.list()) {
@@ -58,7 +58,7 @@ public class ImapFolderServiceImpl exten
     /**
      * Walk through the folder's sub-folders and add sub-folders to current
      * imapFolder
-     * 
+     *
      * @param folder Folder to walk
      * @param imapFolder Current IMAPFolder
      * @throws MessagingException If an error occurs
@@ -73,7 +73,7 @@ public class ImapFolderServiceImpl exten
 
     /**
      * Create a new IMAPFolder from the given Folder
-     * 
+     *
      * @param folder Current folder
      * @return imapFolder Created IMAPFolder
      * @throws Exception If an error occurs

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LoginUserService.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LoginUserService.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LoginUserService.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LoginUserService.java Thu Mar 20 08:16:02 2014
@@ -1,31 +1,31 @@
-/****************************************************************
- * 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.service;
-
-import javax.mail.MessagingException;
-
-import org.apache.hupa.shared.domain.Settings;
-import org.apache.hupa.shared.domain.User;
-import org.apache.hupa.shared.exception.HupaException;
-
-public interface LoginUserService {
-    User login(String username, String password, Settings settings) throws HupaException, MessagingException;
-    Settings getSettings(String email);
-}
+/****************************************************************
+ * 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.service;
+
+import javax.mail.MessagingException;
+
+import org.apache.hupa.shared.domain.Settings;
+import org.apache.hupa.shared.domain.User;
+import org.apache.hupa.shared.exception.HupaException;
+
+public interface LoginUserService {
+    User login(String username, String password, Settings settings) throws HupaException, MessagingException;
+    Settings getSettings(String email);
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LoginUserServiceImpl.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LoginUserServiceImpl.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LoginUserServiceImpl.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LoginUserServiceImpl.java Thu Mar 20 08:16:02 2014
@@ -1,93 +1,93 @@
-/****************************************************************
- * 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.service;
-
-import javax.mail.MessagingException;
-import javax.servlet.http.HttpSession;
-
-import org.apache.hupa.server.utils.SessionUtils;
-import org.apache.hupa.server.utils.SettingsDiscoverer;
-import org.apache.hupa.shared.SConsts;
-import org.apache.hupa.shared.data.UserImpl;
-import org.apache.hupa.shared.domain.Settings;
-import org.apache.hupa.shared.domain.User;
-import org.apache.hupa.shared.exception.HupaException;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-
-public class LoginUserServiceImpl extends AbstractService implements LoginUserService {
-
-    @Inject private Provider<Settings> settingsProvider;
-    @Inject private SettingsDiscoverer settingsDiscoverer;
-
-    public User login(String username, String password, Settings settings) throws HupaException, MessagingException {
-        logger.debug("Login user: " + username + " " + password);
-        try {
-            HttpSession httpSession = httpSessionProvider.get();
-            SessionUtils.cleanSessionAttributes(httpSession);
-            User user = new UserImpl();
-            user.setName(username);
-            user.setPassword(password);
-            user.setSettings(fix(settings));
-            cache.get(user);
-            user.setAuthenticated(true);
-            httpSession.setAttribute(SConsts.USER_SESS_ATTR, user);
-            logger.debug("Logged user: " + username);
-            settingsDiscoverer.setValidSettings(user);
-            return user;
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new RuntimeException(e);
-        }
-    }
-    
-    private Settings fix(Settings a) {
-        if (settingsProvider != null) {
-            Settings b = settingsProvider.get();
-            if (a == null) {
-                return b;
-            }
-            a.setImapServer(or(a.getImapServer(), b.getImapServer()));
-            a.setImapPort(or(a.getImapPort(), b.getImapPort()));
-            a.setSmtpServer((or(a.getSmtpServer(), b.getSmtpServer())));
-            a.setSmtpPort(or(a.getSmtpPort(), b.getSmtpPort()));
-            
-            a.setInboxFolderName(or(a.getInboxFolderName(), b.getInboxFolderName()));
-            a.setSentFolderName(or(a.getSentFolderName(), b.getSentFolderName()));
-            a.setTrashFolderName(or(a.getTrashFolderName(), b.getTrashFolderName()));
-            a.setDraftsFolderName(or(a.getDraftsFolderName(), b.getDraftsFolderName()));
-        }
-        return a;
-    }
-    
-    private <T> T or (T a, T b) {
-        return a == null ? b : a;
-    }
-
-    @Override
-    public Settings getSettings(String email) {
-        if (settingsDiscoverer == null) {
-            settingsDiscoverer = new SettingsDiscoverer();
-        }
-        return settingsDiscoverer.discoverSettings(email);
-    }
-
-}
+/****************************************************************
+ * 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.service;
+
+import javax.mail.MessagingException;
+import javax.servlet.http.HttpSession;
+
+import org.apache.hupa.server.utils.SessionUtils;
+import org.apache.hupa.server.utils.SettingsDiscoverer;
+import org.apache.hupa.shared.SConsts;
+import org.apache.hupa.shared.data.UserImpl;
+import org.apache.hupa.shared.domain.Settings;
+import org.apache.hupa.shared.domain.User;
+import org.apache.hupa.shared.exception.HupaException;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class LoginUserServiceImpl extends AbstractService implements LoginUserService {
+
+    @Inject private Provider<Settings> settingsProvider;
+    @Inject private SettingsDiscoverer settingsDiscoverer;
+
+    public User login(String username, String password, Settings settings) throws HupaException, MessagingException {
+        logger.debug("Login user: " + username + " " + password);
+        try {
+            HttpSession httpSession = httpSessionProvider.get();
+            SessionUtils.cleanSessionAttributes(httpSession);
+            User user = new UserImpl();
+            user.setName(username);
+            user.setPassword(password);
+            user.setSettings(fix(settings));
+            cache.get(user);
+            user.setAuthenticated(true);
+            httpSession.setAttribute(SConsts.USER_SESS_ATTR, user);
+            logger.debug("Logged user: " + username);
+            settingsDiscoverer.setValidSettings(user);
+            return user;
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+    }
+
+    private Settings fix(Settings a) {
+        if (settingsProvider != null) {
+            Settings b = settingsProvider.get();
+            if (a == null) {
+                return b;
+            }
+            a.setImapServer(or(a.getImapServer(), b.getImapServer()));
+            a.setImapPort(or(a.getImapPort(), b.getImapPort()));
+            a.setSmtpServer((or(a.getSmtpServer(), b.getSmtpServer())));
+            a.setSmtpPort(or(a.getSmtpPort(), b.getSmtpPort()));
+
+            a.setInboxFolderName(or(a.getInboxFolderName(), b.getInboxFolderName()));
+            a.setSentFolderName(or(a.getSentFolderName(), b.getSentFolderName()));
+            a.setTrashFolderName(or(a.getTrashFolderName(), b.getTrashFolderName()));
+            a.setDraftsFolderName(or(a.getDraftsFolderName(), b.getDraftsFolderName()));
+        }
+        return a;
+    }
+
+    private <T> T or (T a, T b) {
+        return a == null ? b : a;
+    }
+
+    @Override
+    public Settings getSettings(String email) {
+        if (settingsDiscoverer == null) {
+            settingsDiscoverer = new SettingsDiscoverer();
+        }
+        return settingsDiscoverer.discoverSettings(email);
+    }
+
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LogoutUserService.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LogoutUserService.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LogoutUserService.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LogoutUserService.java Thu Mar 20 08:16:02 2014
@@ -1,27 +1,27 @@
-/****************************************************************
- * 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.service;
-
-import org.apache.hupa.shared.domain.LogoutUserResult;
-import org.apache.hupa.shared.exception.HupaException;
-
-public interface LogoutUserService {
-    LogoutUserResult logout() throws HupaException;
-}
+/****************************************************************
+ * 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.service;
+
+import org.apache.hupa.shared.domain.LogoutUserResult;
+import org.apache.hupa.shared.exception.HupaException;
+
+public interface LogoutUserService {
+    LogoutUserResult logout() throws HupaException;
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LogoutUserServiceImpl.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LogoutUserServiceImpl.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LogoutUserServiceImpl.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LogoutUserServiceImpl.java Thu Mar 20 08:16:02 2014
@@ -1,44 +1,44 @@
-/****************************************************************
- * 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.service;
-
-import org.apache.hupa.server.utils.SessionUtils;
-import org.apache.hupa.shared.data.LogoutUserResultImpl;
-import org.apache.hupa.shared.domain.LogoutUserResult;
-import org.apache.hupa.shared.domain.User;
-import org.apache.hupa.shared.exception.HupaException;
-
-public class LogoutUserServiceImpl extends AbstractService implements LogoutUserService {
-    @Override
-    public LogoutUserResult logout() throws HupaException {
-
-        User user = getUser();
-        user.setAuthenticated(false);
-
-        // delete cached store
-        cache.delete(user);
-
-        // remove user attributes from session
-        SessionUtils.cleanSessionAttributes(httpSessionProvider.get());
-
-        return new LogoutUserResultImpl(user);
-
-    }
-}
+/****************************************************************
+ * 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.service;
+
+import org.apache.hupa.server.utils.SessionUtils;
+import org.apache.hupa.shared.data.LogoutUserResultImpl;
+import org.apache.hupa.shared.domain.LogoutUserResult;
+import org.apache.hupa.shared.domain.User;
+import org.apache.hupa.shared.exception.HupaException;
+
+public class LogoutUserServiceImpl extends AbstractService implements LogoutUserService {
+    @Override
+    public LogoutUserResult logout() throws HupaException {
+
+        User user = getUser();
+        user.setAuthenticated(false);
+
+        // delete cached store
+        cache.delete(user);
+
+        // remove user attributes from session
+        SessionUtils.cleanSessionAttributes(httpSessionProvider.get());
+
+        return new LogoutUserResultImpl(user);
+
+    }
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/MoveMessageService.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/MoveMessageService.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/MoveMessageService.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/MoveMessageService.java Thu Mar 20 08:16:02 2014
@@ -1,27 +1,27 @@
-/****************************************************************
- * 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.service;
-
-import org.apache.hupa.shared.domain.GenericResult;
-import org.apache.hupa.shared.domain.MoveMessageAction;
-
-public interface MoveMessageService {
-    GenericResult move(MoveMessageAction action)throws Exception;
-}
+/****************************************************************
+ * 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.service;
+
+import org.apache.hupa.shared.domain.GenericResult;
+import org.apache.hupa.shared.domain.MoveMessageAction;
+
+public interface MoveMessageService {
+    GenericResult move(MoveMessageAction action)throws Exception;
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/MoveMessageServiceImpl.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/MoveMessageServiceImpl.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/MoveMessageServiceImpl.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/MoveMessageServiceImpl.java Thu Mar 20 08:16:02 2014
@@ -1,63 +1,63 @@
-/****************************************************************
- * 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.service;
-
-import javax.mail.Flags;
-import javax.mail.Folder;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-
-import org.apache.hupa.shared.data.GenericResultImpl;
-import org.apache.hupa.shared.domain.GenericResult;
-import org.apache.hupa.shared.domain.MoveMessageAction;
-import org.apache.hupa.shared.domain.User;
-
-import com.sun.mail.imap.IMAPFolder;
-import com.sun.mail.imap.IMAPStore;
-
-public class MoveMessageServiceImpl extends AbstractService implements MoveMessageService {
-    public GenericResult move(MoveMessageAction action) throws Exception {
-        User user = getUser();
-        try {
-            IMAPStore store = cache.get(user);
-            IMAPFolder folder = (IMAPFolder) store.getFolder(action.getOldFolder().getFullName());
-            if (folder.isOpen() == false) {
-                folder.open(Folder.READ_WRITE);
-            }
-            Message m = folder.getMessageByUID(action.getMessageUid());
-            Message[] mArray = new Message[] { m };
-            folder.copyMessages(mArray, store.getFolder(action.getNewFolder().getFullName()));
-            folder.setFlags(mArray, new Flags(Flags.Flag.DELETED), true);
-            try {
-                folder.expunge(mArray);
-                folder.close(false);
-            } catch (MessagingException e) {
-                // prolly UID expunge is not supported
-                folder.close(true);
-            }
-            return new GenericResultImpl();
-        } catch (MessagingException e) {
-            logger.error(
-                    "Error while moving message " + action.getMessageUid() + " from folder " + action.getOldFolder()
-                            + " to " + action.getNewFolder(), e);
-            throw new Exception(e);
-        }
-    }
-}
+/****************************************************************
+ * 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.service;
+
+import javax.mail.Flags;
+import javax.mail.Folder;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+
+import org.apache.hupa.shared.data.GenericResultImpl;
+import org.apache.hupa.shared.domain.GenericResult;
+import org.apache.hupa.shared.domain.MoveMessageAction;
+import org.apache.hupa.shared.domain.User;
+
+import com.sun.mail.imap.IMAPFolder;
+import com.sun.mail.imap.IMAPStore;
+
+public class MoveMessageServiceImpl extends AbstractService implements MoveMessageService {
+    public GenericResult move(MoveMessageAction action) throws Exception {
+        User user = getUser();
+        try {
+            IMAPStore store = cache.get(user);
+            IMAPFolder folder = (IMAPFolder) store.getFolder(action.getOldFolder().getFullName());
+            if (folder.isOpen() == false) {
+                folder.open(Folder.READ_WRITE);
+            }
+            Message m = folder.getMessageByUID(action.getMessageUid());
+            Message[] mArray = new Message[] { m };
+            folder.copyMessages(mArray, store.getFolder(action.getNewFolder().getFullName()));
+            folder.setFlags(mArray, new Flags(Flags.Flag.DELETED), true);
+            try {
+                folder.expunge(mArray);
+                folder.close(false);
+            } catch (MessagingException e) {
+                // prolly UID expunge is not supported
+                folder.close(true);
+            }
+            return new GenericResultImpl();
+        } catch (MessagingException e) {
+            logger.error(
+                    "Error while moving message " + action.getMessageUid() + " from folder " + action.getOldFolder()
+                            + " to " + action.getNewFolder(), e);
+            throw new Exception(e);
+        }
+    }
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/RenameFolderService.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/RenameFolderService.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/RenameFolderService.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/RenameFolderService.java Thu Mar 20 08:16:02 2014
@@ -1,27 +1,27 @@
-/****************************************************************
- * 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.service;
-
-import org.apache.hupa.shared.domain.GenericResult;
-import org.apache.hupa.shared.domain.RenameFolderAction;
-
-public interface RenameFolderService {
-    GenericResult rename(RenameFolderAction action) throws Exception;
-}
+/****************************************************************
+ * 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.service;
+
+import org.apache.hupa.shared.domain.GenericResult;
+import org.apache.hupa.shared.domain.RenameFolderAction;
+
+public interface RenameFolderService {
+    GenericResult rename(RenameFolderAction action) throws Exception;
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/RenameFolderServiceImpl.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/RenameFolderServiceImpl.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/RenameFolderServiceImpl.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/RenameFolderServiceImpl.java Thu Mar 20 08:16:02 2014
@@ -1,52 +1,52 @@
-/****************************************************************
- * 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.service;
-
-import javax.mail.Folder;
-
-import org.apache.hupa.shared.data.GenericResultImpl;
-import org.apache.hupa.shared.domain.GenericResult;
-import org.apache.hupa.shared.domain.ImapFolder;
-import org.apache.hupa.shared.domain.RenameFolderAction;
-import org.apache.hupa.shared.domain.User;
-
-import com.sun.mail.imap.IMAPStore;
-
-public class RenameFolderServiceImpl extends AbstractService implements RenameFolderService {
-
-    @Override
-    public GenericResult rename(RenameFolderAction action) throws Exception {
-        User user = getUser();
-        ImapFolder folder = action.getFolder();
-        String newName = action.getNewName();
-        IMAPStore store = cache.get(user);
-        com.sun.mail.imap.IMAPFolder iFolder = (com.sun.mail.imap.IMAPFolder) store.getFolder(folder.getFullName());
-        Folder newFolder = store.getFolder(newName);
-
-        if (iFolder.isOpen()) {
-            iFolder.close(false);
-        }
-        if (iFolder.renameTo(newFolder)) {
-            return new GenericResultImpl();
-        }
-        throw new Exception("Unable to rename Folder " + folder.getFullName() + " to " + newName + " for user " + user);
-    }
-
-}
+/****************************************************************
+ * 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.service;
+
+import javax.mail.Folder;
+
+import org.apache.hupa.shared.data.GenericResultImpl;
+import org.apache.hupa.shared.domain.GenericResult;
+import org.apache.hupa.shared.domain.ImapFolder;
+import org.apache.hupa.shared.domain.RenameFolderAction;
+import org.apache.hupa.shared.domain.User;
+
+import com.sun.mail.imap.IMAPStore;
+
+public class RenameFolderServiceImpl extends AbstractService implements RenameFolderService {
+
+    @Override
+    public GenericResult rename(RenameFolderAction action) throws Exception {
+        User user = getUser();
+        ImapFolder folder = action.getFolder();
+        String newName = action.getNewName();
+        IMAPStore store = cache.get(user);
+        com.sun.mail.imap.IMAPFolder iFolder = (com.sun.mail.imap.IMAPFolder) store.getFolder(folder.getFullName());
+        Folder newFolder = store.getFolder(newName);
+
+        if (iFolder.isOpen()) {
+            iFolder.close(false);
+        }
+        if (iFolder.renameTo(newFolder)) {
+            return new GenericResultImpl();
+        }
+        throw new Exception("Unable to rename Folder " + folder.getFullName() + " to " + newName + " for user " + user);
+    }
+
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/SendForwardMessageService.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/SendForwardMessageService.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/SendForwardMessageService.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/SendForwardMessageService.java Thu Mar 20 08:16:02 2014
@@ -1,27 +1,27 @@
-/****************************************************************
- * 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.service;
-
-import org.apache.hupa.shared.domain.GenericResult;
-import org.apache.hupa.shared.domain.SendMessageAction;
-
-public interface SendForwardMessageService {
-    GenericResult send(SendMessageAction action)throws Exception;
-}
+/****************************************************************
+ * 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.service;
+
+import org.apache.hupa.shared.domain.GenericResult;
+import org.apache.hupa.shared.domain.SendMessageAction;
+
+public interface SendForwardMessageService {
+    GenericResult send(SendMessageAction action)throws Exception;
+}

Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/SendForwardMessageServiceImpl.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/SendForwardMessageServiceImpl.java?rev=1579559&r1=1579558&r2=1579559&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/SendForwardMessageServiceImpl.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/SendForwardMessageServiceImpl.java Thu Mar 20 08:16:02 2014
@@ -1,71 +1,71 @@
-/****************************************************************
- * 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.service;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.mail.Folder;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-
-import org.apache.hupa.server.IMAPStoreCache;
-import org.apache.hupa.server.preferences.UserPreferencesStorage;
-import org.apache.hupa.server.utils.MessageUtils;
-import org.apache.hupa.shared.domain.SendForwardMessageAction;
-import org.apache.hupa.shared.domain.SendMessageAction;
-import org.apache.hupa.shared.exception.HupaException;
-
-import com.google.inject.Inject;
-import com.sun.mail.imap.IMAPFolder;
-import com.sun.mail.imap.IMAPStore;
-
-public class SendForwardMessageServiceImpl extends SendMessageBaseServiceImpl implements SendForwardMessageService {
-
-    @Inject
-    public SendForwardMessageServiceImpl(UserPreferencesStorage preferences, IMAPStoreCache cache) {
-        super(preferences, cache);
-    }
-
-    @Override
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    protected List getAttachments(SendMessageAction action) throws MessagingException, HupaException {
-        SendForwardMessageAction forwardAction = (SendForwardMessageAction)action;
-        List<?> items = new ArrayList();
-        IMAPStore store = cache.get(getUser());
-
-        IMAPFolder folder = (IMAPFolder) store.getFolder(forwardAction.getFolder().getFullName());
-        if (folder.isOpen() == false) {
-            folder.open(Folder.READ_ONLY);
-        }
-        // Put the original attachments in the list 
-        Message msg = folder.getMessageByUID(forwardAction.getUid());
-        try {
-            items = MessageUtils.extractMessageAttachments(logger, msg.getContent());
-            logger.debug("Forwarding a message, extracted: " + items.size() + " from original.");
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        // Put in the list the attachments uploaded by the user
-        items.addAll(super.getAttachments(forwardAction));
-        return items;
-    }
-}
+/****************************************************************
+ * 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.service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.mail.Folder;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+
+import org.apache.hupa.server.IMAPStoreCache;
+import org.apache.hupa.server.preferences.UserPreferencesStorage;
+import org.apache.hupa.server.utils.MessageUtils;
+import org.apache.hupa.shared.domain.SendForwardMessageAction;
+import org.apache.hupa.shared.domain.SendMessageAction;
+import org.apache.hupa.shared.exception.HupaException;
+
+import com.google.inject.Inject;
+import com.sun.mail.imap.IMAPFolder;
+import com.sun.mail.imap.IMAPStore;
+
+public class SendForwardMessageServiceImpl extends SendMessageBaseServiceImpl implements SendForwardMessageService {
+
+    @Inject
+    public SendForwardMessageServiceImpl(UserPreferencesStorage preferences, IMAPStoreCache cache) {
+        super(preferences, cache);
+    }
+
+    @Override
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    protected List getAttachments(SendMessageAction action) throws MessagingException, HupaException {
+        SendForwardMessageAction forwardAction = (SendForwardMessageAction)action;
+        List<?> items = new ArrayList();
+        IMAPStore store = cache.get(getUser());
+
+        IMAPFolder folder = (IMAPFolder) store.getFolder(forwardAction.getFolder().getFullName());
+        if (folder.isOpen() == false) {
+            folder.open(Folder.READ_ONLY);
+        }
+        // Put the original attachments in the list
+        Message msg = folder.getMessageByUID(forwardAction.getUid());
+        try {
+            items = MessageUtils.extractMessageAttachments(logger, msg.getContent());
+            logger.debug("Forwarding a message, extracted: " + items.size() + " from original.");
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        // Put in the list the attachments uploaded by the user
+        items.addAll(super.getAttachments(forwardAction));
+        return items;
+    }
+}



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