Author: norman
Date: Mon Dec 27 16:33:04 2010
New Revision: 1053103
URL: http://svn.apache.org/viewvc?rev=1053103&view=rev
Log:
Replace tabs with spaces
Modified:
james/mailbox/trunk/copier/src/main/java/org/apache/james/mailbox/copier/MailboxCopier.java
james/mailbox/trunk/copier/src/main/java/org/apache/james/mailbox/copier/MailboxCopierImpl.java
Modified:
james/mailbox/trunk/copier/src/main/java/org/apache/james/mailbox/copier/MailboxCopier.java
URL:
http://svn.apache.org/viewvc/james/mailbox/trunk/copier/src/main/java/org/apache/james/mailbox/copier/MailboxCopier.java?rev=1053103&r1=1053102&r2=1053103&view=diff
==============================================================================
---
james/mailbox/trunk/copier/src/main/java/org/apache/james/mailbox/copier/MailboxCopier.java
(original)
+++
james/mailbox/trunk/copier/src/main/java/org/apache/james/mailbox/copier/MailboxCopier.java
Mon Dec 27 16:33:04 2010
@@ -19,22 +19,20 @@
package org.apache.james.mailbox.copier;
/**
- * Interface that exposes a method aimed to copy all
- * mailboxes from a source mailbox manager to a destination
- * mailbox manager.
+ * Interface that exposes a method aimed to copy all mailboxes from a source
+ * mailbox manager to a destination mailbox manager.
*
*/
public interface MailboxCopier {
- /**
- * Copy the mailboxes from a mailbox manager to another mailbox manager.
- * The implementation is responsible to read all mailboxes form the
- * injected srcMailboxManager and to copy all its contents to the
- * dstMailboxManager.
- *
- * @return true if copy is completely successful, false if copy fails
- * at any step.
- */
- boolean copyMailboxes();
-
+ /**
+ * Copy the mailboxes from a mailbox manager to another mailbox manager.
The
+ * implementation is responsible to read all mailboxes form the injected
+ * srcMailboxManager and to copy all its contents to the dstMailboxManager.
+ *
+ * @return true if copy is completely successful, false if copy fails at
any
+ * step.
+ */
+ boolean copyMailboxes();
+
}
Modified:
james/mailbox/trunk/copier/src/main/java/org/apache/james/mailbox/copier/MailboxCopierImpl.java
URL:
http://svn.apache.org/viewvc/james/mailbox/trunk/copier/src/main/java/org/apache/james/mailbox/copier/MailboxCopierImpl.java?rev=1053103&r1=1053102&r2=1053103&view=diff
==============================================================================
---
james/mailbox/trunk/copier/src/main/java/org/apache/james/mailbox/copier/MailboxCopierImpl.java
(original)
+++
james/mailbox/trunk/copier/src/main/java/org/apache/james/mailbox/copier/MailboxCopierImpl.java
Mon Dec 27 16:33:04 2010
@@ -39,99 +39,97 @@ import org.apache.james.mailbox.util.Fet
/**
* Implementation of the {...@link MailboxCopier} interface.
- *
+ *
*/
public class MailboxCopierImpl implements MailboxCopier {
-
+
/**
* The logger.
*/
private Log log = LogFactory.getLog("org.apache.james.mailbox.copier");
/**
- * The source MailboxManager from which all mailboxes will be read
- * and copied to the destination MailboxManager.
+ * The source MailboxManager from which all mailboxes will be read and
+ * copied to the destination MailboxManager.
*/
private MailboxManager srcMailboxManager;
-
- /**
- * The destination MailboxManager to which all mailboxes read from
- * the source MailboxManager and copied to the destination MailboxManager.
- */
- private MailboxManager dstMailboxManager;
-
- /* (non-Javadoc)
- * @see org.apache.james.mailbox.copier.MailboxCopier#copyMailboxes()
- */
- public boolean copyMailboxes() {
-
+
+ /**
+ * The destination MailboxManager to which all mailboxes read from the
+ * source MailboxManager and copied to the destination MailboxManager.
+ */
+ private MailboxManager dstMailboxManager;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.james.mailbox.copier.MailboxCopier#copyMailboxes()
+ */
+ public boolean copyMailboxes() {
+
MailboxSession srcMailboxSession;
MailboxSession dstMailboxSession;
-
- try {
+
+ try {
srcMailboxSession =
srcMailboxManager.createSystemSession("manager", log);
- } catch (BadCredentialsException e) {
- log.error(e.getMessage());
- return false;
- } catch (MailboxException e) {
- log.error(e.getMessage());
- return false;
- }
-
+ } catch (BadCredentialsException e) {
+ log.error(e.getMessage());
+ return false;
+ } catch (MailboxException e) {
+ log.error(e.getMessage());
+ return false;
+ }
+
srcMailboxManager.startProcessingRequest(srcMailboxSession);
-
+
try {
-
- List<MailboxPath> mailboxPathList =
srcMailboxManager.list(srcMailboxSession);
-
- for (MailboxPath mailboxPath: mailboxPathList) {
-
- try {
- dstMailboxSession =
dstMailboxManager.createSystemSession(mailboxPath.getUser(), log);
- } catch (BadCredentialsException e) {
- log.error(e.getMessage());
- return false;
- } catch (MailboxException e) {
- log.error(e.getMessage());
- return false;
- }
-
- dstMailboxManager.startProcessingRequest(dstMailboxSession);
- dstMailboxManager.createMailbox(mailboxPath,
dstMailboxSession);
- dstMailboxManager.endProcessingRequest(dstMailboxSession);
-
- MessageManager srcMessageManager =
srcMailboxManager.getMailbox(mailboxPath, srcMailboxSession);
-
- Iterator<MessageResult> messageResultIterator =
srcMessageManager.getMessages(MessageRange.all(), FetchGroupImpl.FULL_CONTENT,
srcMailboxSession);
-
- while (messageResultIterator.hasNext()) {
-
- MessageResult messageResult =
messageResultIterator.next();
- InputStreamContent content = (InputStreamContent)
messageResult.getFullContent();
-
- try {
- dstMailboxSession =
dstMailboxManager.createSystemSession(mailboxPath.getUser(), log);
- } catch (BadCredentialsException e) {
- log.error(e.getMessage());
- return false;
- } catch (MailboxException e) {
- log.error(e.getMessage());
- return false;
- }
-
+
+ List<MailboxPath> mailboxPathList =
srcMailboxManager.list(srcMailboxSession);
+
+ for (MailboxPath mailboxPath : mailboxPathList) {
+
+ try {
+ dstMailboxSession =
dstMailboxManager.createSystemSession(mailboxPath.getUser(), log);
+ } catch (BadCredentialsException e) {
+ log.error(e.getMessage());
+ return false;
+ } catch (MailboxException e) {
+ log.error(e.getMessage());
+ return false;
+ }
+
+ dstMailboxManager.startProcessingRequest(dstMailboxSession);
+ dstMailboxManager.createMailbox(mailboxPath,
dstMailboxSession);
+ dstMailboxManager.endProcessingRequest(dstMailboxSession);
+
+ MessageManager srcMessageManager =
srcMailboxManager.getMailbox(mailboxPath, srcMailboxSession);
+
+ Iterator<MessageResult> messageResultIterator =
srcMessageManager.getMessages(MessageRange.all(), FetchGroupImpl.FULL_CONTENT,
srcMailboxSession);
+
+ while (messageResultIterator.hasNext()) {
+
+ MessageResult messageResult = messageResultIterator.next();
+ InputStreamContent content = (InputStreamContent)
messageResult.getFullContent();
+
+ try {
+ dstMailboxSession =
dstMailboxManager.createSystemSession(mailboxPath.getUser(), log);
+ } catch (BadCredentialsException e) {
+ log.error(e.getMessage());
+ return false;
+ } catch (MailboxException e) {
+ log.error(e.getMessage());
+ return false;
+ }
+
dstMailboxManager.startProcessingRequest(dstMailboxSession);
MessageManager dstMessageManager =
dstMailboxManager.getMailbox(mailboxPath, dstMailboxSession);
-
dstMessageManager.appendMessage(content.getInputStream(),
- messageResult.getInternalDate(),
- dstMailboxSession,
- messageResult.getFlags().contains(Flag.RECENT),
- messageResult.getFlags());
-
dstMailboxManager.endProcessingRequest(dstMailboxSession);
-
- }
-
- }
-
+ dstMessageManager.appendMessage(content.getInputStream(),
messageResult.getInternalDate(), dstMailboxSession,
messageResult.getFlags().contains(Flag.RECENT), messageResult.getFlags());
+ dstMailboxManager.endProcessingRequest(dstMailboxSession);
+
+ }
+
+ }
+
} catch (MailboxException e) {
log.error(e.getMessage());
return false;
@@ -140,25 +138,25 @@ public class MailboxCopierImpl implement
e.printStackTrace();
return false;
}
-
+
srcMailboxManager.endProcessingRequest(srcMailboxSession);
-
+
try {
- srcMailboxManager.logout(srcMailboxSession, true);
+ srcMailboxManager.logout(srcMailboxSession, true);
} catch (MailboxException e) {
log.error(e.getMessage());
- return false;
+ return false;
}
-
+
return true;
- }
-
+ }
+
/**
* Setter to inject the srcMailboxManager.
*
- * All mailboxes from the srcMailboxManager will be copied
- * to the dstMailboxManager upon copyMaillboxes method call.
+ * All mailboxes from the srcMailboxManager will be copied to the
+ * dstMailboxManager upon copyMaillboxes method call.
*
* @param srcMailboxManager
*/
@@ -169,13 +167,13 @@ public class MailboxCopierImpl implement
/**
* Setter to inject the dstMailboxManager.
*
- * All mailboxes from the srcMailboxManager will be copied
- * to the dstMailboxManager upon copyMaillboxes method call.
+ * All mailboxes from the srcMailboxManager will be copied to the
+ * dstMailboxManager upon copyMaillboxes method call.
*
* @param dstMailboxManager
*/
public void setDstMailboxManager(MailboxManager dstMailboxManager) {
this.dstMailboxManager = dstMailboxManager;
}
-
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]