AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Maildir is not visible

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Matej Cepl
Guest





PostPosted: Tue May 22, 2007 2:40 am    Post subject: Maildir is not visible Reply with quote



OK, this is probably another newbie question, but let me try.
I have this testing program to copy all messages from one mbox
folder to another maildir one:

import java.util.Properties;
import javax.mail.*;
import gnu.mail.providers.maildir.*;

public class CopyFolder {

/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
String urlStr = "/home/matej/.eclipse/workspace"+
"/kmail2tbfolders/examples/";
Session session = Session.getInstance(new Properties());
session.setDebug(true);
URLName storeURL = new URLName("mbox://"+urlStr);
Store mboxStore = session.getStore(storeURL);
mboxStore.connect();
Folder mboxFolder = mboxStore.getDefaultFolder();
mboxFolder = mboxStore.getFolder("test");
mboxFolder.open(Folder.READ_WRITE);

URLName store2URL = new URLName("maildir://"+urlStr+"/output/");
Store maildirStore = session.getStore(store2URL);
Folder targetFolder = new MaildirFolder(maildirStore, "target");
if (targetFolder.create(Folder.HOLDS_MESSAGES)) {
targetFolder.open(Folder.READ_WRITE);
Message[] messages = mboxFolder.getMessages();
Message[] messagesToGo;
for (int i=0;i<messages.length;i++) {
boolean success = messagesToGo.add(messages[i]);
}
targetFolder.appendMessages(messagesToGo);
}
mboxStore.close();
maildirStore.close();
}

}

When I try to compile this with gcj (4.1.1. compatible with Java
1.4) I get these error messages:

[matej@chelcicky kmail2tbfolders]$ javac CopyFolder.java
----------
1. ERROR in CopyFolder.java (at line 25)
Folder targetFolder = new MaildirFolder(maildirStore, "target");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor MaildirFolder(Store, String) is not visible
----------
2. ERROR in CopyFolder.java (at line 31)
boolean success = messagesToGo.add(messages[i]);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Cannot invoke add(Message) on the array type Message[]
----------
2 problems (2 errors)[matej@chelcicky kmail2tbfolders]$

Does anybody have any idea, what's going on here? There is
MaildirFolder imported above, so it should be available (and
apparently eclipse doesn't have any problems with the idea), but
it isn't. The second is how can I add messages to the final
Message[] array which could be then sent to appendMessages?

Thanks,

Matej Cepl
Back to top
Mark Space
Guest





PostPosted: Tue May 22, 2007 7:00 am    Post subject: Re: Maildir is not visible Reply with quote



Matej Cepl wrote:

Quote:

[matej@chelcicky kmail2tbfolders]$ javac CopyFolder.java
----------
1. ERROR in CopyFolder.java (at line 25)
Folder targetFolder = new MaildirFolder(maildirStore, "target");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor MaildirFolder(Store, String) is not visible
----------


Read the manual.

http://www.gnu.org/software/classpathx/javamail/javadoc/gnu/mail/providers/maildir/MaildirFolder.html

protected MaildirFolder(Store store,
String filename)

Constructor.

MaildirFolder

protected MaildirFolder(Store store,
String filename,
boolean root,
boolean inbox)

Both constructors are protected, you can't get at them externally.
Probably a factory method around someplace to make these objects, I
didn't read that far though, just a quick Google search.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.