[jira] Commented: (JAMES-1184) Modules consolidation

2011-01-20 Thread Eric Charles (JIRA)

[ 
https://issues.apache.org/jira/browse/JAMES-1184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12984114#action_12984114
 ] 

Eric Charles commented on JAMES-1184:
-

I use deep-nested maven modules for other projects, so I like the idea.

I'm a bit worried that we look at james-server only and not thinking on a james 
wide level, for example I like the idea to group imap/pop3/smtp in a module you 
called protocols, but this is confusing with the top protocols project 
which only holds smtp.
I wonder what the exercice would give if we started from the top-level james 
folder, having that nested modules. would we regroup another way ? Would we 
name modules differently (the module names, but also the prefix : some start 
with james-server, other with apache-james).

btw, I don't think it's worth to start that exercice now, cause we've got to 
foccus on 3.0 server release which can perfectly happen with current structure.

For now, I still translate data to persist, so queue in data does not 
sound good to me (queuing job is quite different from persisting).


 Modules consolidation
 -

 Key: JAMES-1184
 URL: https://issues.apache.org/jira/browse/JAMES-1184
 Project: JAMES Server
  Issue Type: Task
  Components: Build System
Affects Versions: 3.0-M2
Reporter: Stefano Bagnara
Assignee: Stefano Bagnara
 Fix For: 3.0-M3

 Attachments: graph-server-utils.gif, graph-server.gif


 Just opening it to keep track of the proposal to the mailing list.
 
 - mail-file(3)
 - mail-jcr(1)
 - mail-jdbc(3)
 - user-jpa(4)
 - user-file(2)
 - user-jcr(2)
 - user-jdbc(4)
 - domainlist-jpa(2)
 - domainlist-xml(1)
 I only see benefits and no drawbacks in consolidating the 9 modules
 above to the following 4 modules:
  persistence-jpa(6) = user-jpa(4)+domainlist-jpa(2)
  persistence-file(6) = user-file(2)+mail-file(3)+domainlist-xml(1)
  persistence-jcr(3) = user-jcr(2)+mail-jcr(1)
  persistence-jdbc(7) = user-jdbc(4)+mail-jdbc(3)
 - mail-library(1)
 - domainlist-library(2)
 - user-library(9)
 We could consolidate them into a persistence-library module (from 3 to
 1 module).
  persistence-library(12) =
 mail-library(1)+domainlist-library(2)+user-library(9)
 - queue-library(2)
 - queue-jms(5)
 We could merge queue-library to queue-jms (a library module makes
 sense when we do something useful.. if it is trivial stuff it can be
 duplicated or moved to the api layer).
  queue-jms(7) = queue-jms(5)+queue-library(2)
 -
 It seems there is agreement on the merging. We still have to decide whether 
 to name the modules persistence-${type} or simply ${type} (or maybe 
 data-${type})

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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



[jira] Updated: (JAMES-1184) Modules consolidation

2011-01-20 Thread Stefano Bagnara (JIRA)

 [ 
https://issues.apache.org/jira/browse/JAMES-1184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefano Bagnara updated JAMES-1184:
---

Attachment: graph-server-deps-edited.gif

Forgot to share another graph I made yesterday after the second step 
refactoring.

This include external jars dependencies in the chart.

It is interesting to see that our api layer have only this dependencies:
- apache-mailet
- javax.mail
- commons-logging
- commons-configuration
On the library level we add:
- protocols-api
- mailet-base
- protocols-impl
- netty
Then we have 2 shared dependencies in functions:
- jspf-resolver
- protocols-smtp
The good thing is that every other dependency is strictly isolated in a single 
function module and I think this was the main goal of mudules, so it seems we 
did it :-)  (I grouped dependencies with their module when they was used just 
by that module)

I hope to find some time the next weekend to put my hands on the netty stuff 
(it is one of the new things I still don't know very well): I would like to see 
if I can remove netty from the library layer and isolate it to a function 
(using composition and maybe a new api for replacing direct inheritance).

 Modules consolidation
 -

 Key: JAMES-1184
 URL: https://issues.apache.org/jira/browse/JAMES-1184
 Project: JAMES Server
  Issue Type: Task
  Components: Build System
Affects Versions: 3.0-M2
Reporter: Stefano Bagnara
Assignee: Stefano Bagnara
 Fix For: 3.0-M3

 Attachments: graph-server-deps-edited.gif, graph-server-utils.gif, 
 graph-server.gif


 Just opening it to keep track of the proposal to the mailing list.
 
 - mail-file(3)
 - mail-jcr(1)
 - mail-jdbc(3)
 - user-jpa(4)
 - user-file(2)
 - user-jcr(2)
 - user-jdbc(4)
 - domainlist-jpa(2)
 - domainlist-xml(1)
 I only see benefits and no drawbacks in consolidating the 9 modules
 above to the following 4 modules:
  persistence-jpa(6) = user-jpa(4)+domainlist-jpa(2)
  persistence-file(6) = user-file(2)+mail-file(3)+domainlist-xml(1)
  persistence-jcr(3) = user-jcr(2)+mail-jcr(1)
  persistence-jdbc(7) = user-jdbc(4)+mail-jdbc(3)
 - mail-library(1)
 - domainlist-library(2)
 - user-library(9)
 We could consolidate them into a persistence-library module (from 3 to
 1 module).
  persistence-library(12) =
 mail-library(1)+domainlist-library(2)+user-library(9)
 - queue-library(2)
 - queue-jms(5)
 We could merge queue-library to queue-jms (a library module makes
 sense when we do something useful.. if it is trivial stuff it can be
 duplicated or moved to the api layer).
  queue-jms(7) = queue-jms(5)+queue-library(2)
 -
 It seems there is agreement on the merging. We still have to decide whether 
 to name the modules persistence-${type} or simply ${type} (or maybe 
 data-${type})

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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



Re: DB Access with james3

2011-01-20 Thread Eric Charles

Hi,

Probably you did not instantiate spring context.

As first shot, you could copy Main to YourMain
https://svn.apache.org/repos/asf/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/Main.java

and hack it with for example with code sample in [1].

You can also hack the spring context xml files if you don't want to load 
all the beans, but you will still need a few of them to access the mailbox.


Obviously, we could discuss the following:
1. Add some code simple samples for basic operations on mailbox.
2. Have a spring context for mailbox that could be used as a stand-alone 
(and also be imported in server).


Tks,

Eric

[1] code sample (non compiling).

public class YourMain {

private static Log log = LogFactory.getLog(Main.class.getName());

@Ressource(name=mailboxmanager)
private static MailboxManager;

public static void main(String[] args) throws IOException {

final JamesServerApplicationContext context = new 
JamesServerApplicationContext(new String[] { context/james-server-context.xml 
});
context.registerShutdownHook();

// Bad code practice - Refactor it!!!

MailboxPath mailboxPath = MailboxPath.inbox(userName);
MailboxSession mailboxSession = 
mailboxManager.createSystemSession(userName30, log)
mailboxManager.startProcessingRequest(mailboxSession);
try {
mailboxManager.createMailbox(mailboxPath, mailboxSession);
}
catch (MailboxExistsException e) {
// Do nothing, the mailbox already exists.
}

mailboxManager.endProcessingRequest(mailboxSession);

MessageManager messageManager = 
mailboxManager.getMailbox(mailboxPath, mailboxSession);

   // instanciate an input stream that contains your email content (body, 
header,...)
messageManager.appendMessage(your-input-stream,
   new Date(),
   mailboxSession,
   isRecent,
   flags);
   mailboxManager.endProcessingRequest(mailboxSession);
   }

}

}



On 19/01/2011 20:07, Luc Saulière wrote:

Thx for answering so quickly, I tried this in a new package inside
james-server-container-spring project...
I have a public static void main(String[] args) containing my private
staticMailboxManager mailboxManager which
is injected with the annotation @Resource(name=mailboxmanager) from the
spring-bean.xml.
But it does not succeed in initializing the variable and I get a
NullPointerException as soon as I use it...
How can I initialize my beans without running the entire James app?

Tks.


2011/1/19 Eric Charlese...@apache.org


Hi Luc,

Yes, code has changed in trunk since M2 (we don't use MailServer anymore).
In M2, or in trunk, the way to store mail is the same.
If you are deploying the your code/class in the james spring container, you
need to inject the mailboxmanager (with @Resources(name=mailboxmanager)
and have a block of code such as:

MailboxPath mailboxPath = MailboxPath.inbox(userName30);
MailboxSession mailboxSession =
mailboxManager.createSystemSession(userName30, log)
MessageManager messageManager = mailboxManager.getMailbox(mailboxPath,
mailboxSession);
messageManager.appendMessage(your-input-stream,
new Date(),
mailboxSession,
isRecent,
flags);
mailboxManager.endProcessingRequest(mailboxSession);
}

I just realize I can't find a simple test case to in trunk to show this (or
maybe I didn't look good).
If we don't have this, maybe you could open a jira so we can further
provide test samples.
(this comes from  the fact that all our tests were made from an imap
perspective, we moved the imap test to another  project, but we probably
should further enrich the pure mailbox test cases/samples).

Tks,

Eric




On 19/01/2011 18:04, Luc Sauličre wrote:


Hello,
I'm developing with Math on the same mail app. We didn't succeed in
storing
mail as james3 does. In fact the SieveMailet class does not have a
setUsersRepo method, I think you're dealing with a newer version of
James3...
We are developing with the M2 one and SieveMailet have a setMailserver
method instead.
So, is there any way to store a mail (from another IMAP connection for
instance) in the James3 mySQL db, as James3 does (i.e. filling correctly
all
the appropriate tables...)?

Thx for helping.
Luc.

2011/1/17 Eric Charlese...@apache.org

  Hi,

The mails store magic occurs in LocalDelivery where the MailboxManager is
injected.
(more precise, LocalDelivery uses the SieveMailet initialized with the
MailboxManager)
sieveMailet.setUsersRepository(usersRepository);
sieveMailet.setMailboxManager(mailboxManager);
sieveMailet.init(m);
sieveMailet.setQuiet(true);
...
if (mail.getState() != Mail.GHOST) {
sieveMailet.service(mail);
}


[jira] Commented: (JAMES-1184) Modules consolidation

2011-01-20 Thread Stefano Bagnara (JIRA)

[ 
https://issues.apache.org/jira/browse/JAMES-1184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12984122#action_12984122
 ] 

Stefano Bagnara commented on JAMES-1184:


@Norman about utils as library instead of api, it's not a big deal. as I wrote 
it is not something I evaluated well, just wanted to write somewhere a 
temporary thought and decided to do it in this public issue instead of a 
private note. You answer helped me understand that it probably doesn't worth 
touching it (except for the green/yellow classes that can be moved/deleted 
anyway).

@Both about nested layers: I agree this need some more thinking and we should 
ignore this now. Eric made a good point about looking also to external modules 
and organize things from the outside not only focusing on james-server.
about queue modules: I agree that queue management is a bit different from 
persistence, but If I understand it well our queues deal with persistence too. 
It's not a simple queue but a spool queue. I could implement a file based queue 
implementation, or a pure JDBC one (based on the SpoolRepository from james 
2.3): our queue is a persistent store where you can put mail and get mails. BTW 
I'm not strong on this idea that's why I haven't touch the queue-* modules in 
this consolidation.. 

Thanks for your comments, it's getting exciting again to work on james and to 
have constructive discussions! I will probably close this issue soon.

 Modules consolidation
 -

 Key: JAMES-1184
 URL: https://issues.apache.org/jira/browse/JAMES-1184
 Project: JAMES Server
  Issue Type: Task
  Components: Build System
Affects Versions: 3.0-M2
Reporter: Stefano Bagnara
Assignee: Stefano Bagnara
 Fix For: 3.0-M3

 Attachments: graph-server-deps-edited.gif, graph-server-utils.gif, 
 graph-server.gif


 Just opening it to keep track of the proposal to the mailing list.
 
 - mail-file(3)
 - mail-jcr(1)
 - mail-jdbc(3)
 - user-jpa(4)
 - user-file(2)
 - user-jcr(2)
 - user-jdbc(4)
 - domainlist-jpa(2)
 - domainlist-xml(1)
 I only see benefits and no drawbacks in consolidating the 9 modules
 above to the following 4 modules:
  persistence-jpa(6) = user-jpa(4)+domainlist-jpa(2)
  persistence-file(6) = user-file(2)+mail-file(3)+domainlist-xml(1)
  persistence-jcr(3) = user-jcr(2)+mail-jcr(1)
  persistence-jdbc(7) = user-jdbc(4)+mail-jdbc(3)
 - mail-library(1)
 - domainlist-library(2)
 - user-library(9)
 We could consolidate them into a persistence-library module (from 3 to
 1 module).
  persistence-library(12) =
 mail-library(1)+domainlist-library(2)+user-library(9)
 - queue-library(2)
 - queue-jms(5)
 We could merge queue-library to queue-jms (a library module makes
 sense when we do something useful.. if it is trivial stuff it can be
 duplicated or moved to the api layer).
  queue-jms(7) = queue-jms(5)+queue-library(2)
 -
 It seems there is agreement on the merging. We still have to decide whether 
 to name the modules persistence-${type} or simply ${type} (or maybe 
 data-${type})

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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



svn commit: r1061196 - /james/server/trunk/dnsservice-library/src/main/java/org/apache/james/dnsservice/library/netmatcher/NetMatcher.java

2011-01-20 Thread eric
Author: eric
Date: Thu Jan 20 10:29:40 2011
New Revision: 1061196

URL: http://svn.apache.org/viewvc?rev=1061196view=rev
Log:
Use a SortedSet to ensure tests are successfull on all platforms (solaris,...) 
- we don't add many networks, so it should this should not give performance 
impact.

Modified:

james/server/trunk/dnsservice-library/src/main/java/org/apache/james/dnsservice/library/netmatcher/NetMatcher.java

Modified: 
james/server/trunk/dnsservice-library/src/main/java/org/apache/james/dnsservice/library/netmatcher/NetMatcher.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/dnsservice-library/src/main/java/org/apache/james/dnsservice/library/netmatcher/NetMatcher.java?rev=1061196r1=1061195r2=1061196view=diff
==
--- 
james/server/trunk/dnsservice-library/src/main/java/org/apache/james/dnsservice/library/netmatcher/NetMatcher.java
 (original)
+++ 
james/server/trunk/dnsservice-library/src/main/java/org/apache/james/dnsservice/library/netmatcher/NetMatcher.java
 Thu Jan 20 10:29:40 2011
@@ -21,9 +21,10 @@ package org.apache.james.dnsservice.libr
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.Collection;
-import java.util.HashSet;
+import java.util.Comparator;
 import java.util.Iterator;
-import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
 
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.library.inetnetwork.InetNetworkBuilder;
@@ -45,7 +46,7 @@ public class NetMatcher {
 /**
  * The Set of InetNetwork to match against.
  */
-private SetInetNetwork networks;
+private SortedSetInetNetwork networks;
 
 /**
  * Create a new instance of Netmatcher.
@@ -111,6 +112,8 @@ public class NetMatcher {
 }
 
 /**
+ * Return a sorted representation of the inet networks.
+ * 
  * @see InetNetwork#toString()
  */
 public String toString() {
@@ -141,7 +144,11 @@ public class NetMatcher {
  */
 private void initInetNetworks(final String[] nets) {
 
-networks = new HashSetInetNetwork();
+networks = new TreeSetInetNetwork(new ComparatorInetNetwork() {
+public int compare(InetNetwork in1, InetNetwork in2) {
+return in1.toString().compareTo(in2.toString());
+}
+});
 
 final InetNetworkBuilder inetNetwork = new 
InetNetworkBuilder(dnsServer);
 



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



svn commit: r1061209 - in /james/server/trunk: data-library/src/main/java/org/apache/james/mailrepository/lib/ data-library/src/main/java/org/apache/james/vut/lib/ util/src/main/java/org/apache/james/

2011-01-20 Thread bago
Author: bago
Date: Thu Jan 20 10:56:26 2011
New Revision: 1061209

URL: http://svn.apache.org/viewvc?rev=1061209view=rev
Log:
Move Lock from util to data-library.
Remove XMLResources by simply moving 2 static methods to VirtualUserTableUtil 
(they was not XML specific anyway).

Added:

james/server/trunk/data-library/src/main/java/org/apache/james/mailrepository/lib/Lock.java
   (contents, props changed)
  - copied, changed from r1060981, 
james/server/trunk/util/src/main/java/org/apache/james/util/Lock.java
Removed:
james/server/trunk/util/src/main/java/org/apache/james/util/Lock.java
Modified:

james/server/trunk/data-library/src/main/java/org/apache/james/mailrepository/lib/AbstractMailRepository.java

james/server/trunk/data-library/src/main/java/org/apache/james/vut/lib/VirtualUserTableUtil.java

Modified: 
james/server/trunk/data-library/src/main/java/org/apache/james/mailrepository/lib/AbstractMailRepository.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/data-library/src/main/java/org/apache/james/mailrepository/lib/AbstractMailRepository.java?rev=1061209r1=1061208r2=1061209view=diff
==
--- 
james/server/trunk/data-library/src/main/java/org/apache/james/mailrepository/lib/AbstractMailRepository.java
 (original)
+++ 
james/server/trunk/data-library/src/main/java/org/apache/james/mailrepository/lib/AbstractMailRepository.java
 Thu Jan 20 10:56:26 2011
@@ -27,7 +27,6 @@ import org.apache.commons.logging.Log;
 import org.apache.james.lifecycle.api.Configurable;
 import org.apache.james.lifecycle.api.LogEnabled;
 import org.apache.james.mailrepository.api.MailRepository;
-import org.apache.james.util.Lock;
 import org.apache.mailet.Mail;
 
 import javax.mail.MessagingException;

Copied: 
james/server/trunk/data-library/src/main/java/org/apache/james/mailrepository/lib/Lock.java
 (from r1060981, 
james/server/trunk/util/src/main/java/org/apache/james/util/Lock.java)
URL: 
http://svn.apache.org/viewvc/james/server/trunk/data-library/src/main/java/org/apache/james/mailrepository/lib/Lock.java?p2=james/server/trunk/data-library/src/main/java/org/apache/james/mailrepository/lib/Lock.javap1=james/server/trunk/util/src/main/java/org/apache/james/util/Lock.javar1=1060981r2=1061209rev=1061209view=diff
==
--- james/server/trunk/util/src/main/java/org/apache/james/util/Lock.java 
(original)
+++ 
james/server/trunk/data-library/src/main/java/org/apache/james/mailrepository/lib/Lock.java
 Thu Jan 20 10:56:26 2011
@@ -19,7 +19,7 @@
 
 
 
-package org.apache.james.util;
+package org.apache.james.mailrepository.lib;
 
 import java.util.Hashtable;
 

Propchange: 
james/server/trunk/data-library/src/main/java/org/apache/james/mailrepository/lib/Lock.java
--
cvs2svn:cvs-rev = 1.3.4.3

Propchange: 
james/server/trunk/data-library/src/main/java/org/apache/james/mailrepository/lib/Lock.java
--
svn:eol-style = native

Propchange: 
james/server/trunk/data-library/src/main/java/org/apache/james/mailrepository/lib/Lock.java
--
svn:keywords = Author Date Id Revision

Modified: 
james/server/trunk/data-library/src/main/java/org/apache/james/vut/lib/VirtualUserTableUtil.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/data-library/src/main/java/org/apache/james/vut/lib/VirtualUserTableUtil.java?rev=1061209r1=1061208r2=1061209view=diff
==
--- 
james/server/trunk/data-library/src/main/java/org/apache/james/vut/lib/VirtualUserTableUtil.java
 (original)
+++ 
james/server/trunk/data-library/src/main/java/org/apache/james/vut/lib/VirtualUserTableUtil.java
 Thu Jan 20 10:56:26 2011
@@ -28,7 +28,6 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
 
-import org.apache.james.util.XMLResources;
 import org.apache.james.vut.api.VirtualUserTable;
 import org.apache.mailet.MailAddress;
 
@@ -76,11 +75,64 @@ public class VirtualUserTableUtil {
 for (int i = 1; i  match.groupCount(); i++) {
 parameters.put(Integer.toString(i), match.group(i));
 }
-result = 
XMLResources.replaceParameters(targetString.substring(msgPos + 1), parameters);
+result = replaceParameters(targetString.substring(msgPos + 1), 
parameters);
 }
 return result;
  }
- 
+
+/**
+ * Returns a named string, replacing parameters with the values set.
+ * 
+ * @param str  the name of the String resource required.
+ * @param parametersa map of parameters (name-value string pairs) 
which are
+ *   

svn commit: r1061211 - /james/server/trunk/util/src/main/java/org/apache/james/util/XMLResources.java

2011-01-20 Thread bago
Author: bago
Date: Thu Jan 20 10:57:37 2011
New Revision: 1061211

URL: http://svn.apache.org/viewvc?rev=1061211view=rev
Log:
Move Lock from util to data-library.
Remove XMLResources by simply moving 2 static methods to VirtualUserTableUtil 
(they was not XML specific anyway).

Removed:

james/server/trunk/util/src/main/java/org/apache/james/util/XMLResources.java


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



svn commit: r1061213 - in /james/server/trunk: core/pom.xml data-library/pom.xml

2011-01-20 Thread bago
Author: bago
Date: Thu Jan 20 10:59:32 2011
New Revision: 1061213

URL: http://svn.apache.org/viewvc?rev=1061213view=rev
Log:
core and data-library no longer depends on util.

Modified:
james/server/trunk/core/pom.xml
james/server/trunk/data-library/pom.xml

Modified: james/server/trunk/core/pom.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/core/pom.xml?rev=1061213r1=1061212r2=1061213view=diff
==
--- james/server/trunk/core/pom.xml (original)
+++ james/server/trunk/core/pom.xml Thu Jan 20 10:59:32 2011
@@ -41,10 +41,6 @@
   dependencies
 dependency
   groupIdorg.apache.james/groupId
-  artifactIdjames-server-util/artifactId
-/dependency   
-dependency
-  groupIdorg.apache.james/groupId
   artifactIdjames-server-lifecycle-api/artifactId
 /dependency   
 

Modified: james/server/trunk/data-library/pom.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/data-library/pom.xml?rev=1061213r1=1061212r2=1061213view=diff
==
--- james/server/trunk/data-library/pom.xml (original)
+++ james/server/trunk/data-library/pom.xml Thu Jan 20 10:59:32 2011
@@ -34,10 +34,6 @@
 /dependency
 dependency
   groupIdorg.apache.james/groupId
-  artifactIdjames-server-util/artifactId
-/dependency
-dependency
-  groupIdorg.apache.james/groupId
   artifactIdjames-server-data-api/artifactId
 /dependency
 dependency



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



svn commit: r1061242 - in /james/server/trunk: pop3server/src/main/java/org/apache/james/pop3server/core/ pop3server/src/test/java/org/apache/james/pop3server/ protocols-library/src/main/java/org/apac

2011-01-20 Thread norman
Author: norman
Date: Thu Jan 20 11:48:46 2011
New Revision: 1061242

URL: http://svn.apache.org/viewvc?rev=1061242view=rev
Log:
Move Pop3BeforeSMTPHelper to protocols-library as its specific to pop3/smtp

Added:

james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/POP3BeforeSMTPHelper.java
  - copied, changed from r1061130, 
james/server/trunk/util/src/main/java/org/apache/james/util/POP3BeforeSMTPHelper.java
Modified:

james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java

james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java

james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/POP3BeforeSMTPHandler.java

james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/POP3BeforeSMTPHandlerTest.java

Modified: 
james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java?rev=1061242r1=1061241r2=1061242view=diff
==
--- 
james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java
 (original)
+++ 
james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/core/PassCmdHandler.java
 Thu Jan 20 11:48:46 2011
@@ -35,7 +35,7 @@ import org.apache.james.pop3server.POP3R
 import org.apache.james.pop3server.POP3Session;
 import org.apache.james.protocols.api.Request;
 import org.apache.james.protocols.api.Response;
-import org.apache.james.util.POP3BeforeSMTPHelper;
+import org.apache.james.protocols.lib.POP3BeforeSMTPHelper;
 
 /**
  * Handles PASS command

Modified: 
james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java?rev=1061242r1=1061241r2=1061242view=diff
==
--- 
james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
 (original)
+++ 
james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
 Thu Jan 20 11:48:46 2011
@@ -49,12 +49,12 @@ import org.apache.james.mailbox.inmemory
 import org.apache.james.mailbox.inmemory.mail.InMemoryCachingUidProvider;
 import org.apache.james.mailbox.store.Authenticator;
 import org.apache.james.pop3server.netty.POP3Server;
+import org.apache.james.protocols.lib.POP3BeforeSMTPHelper;
 import org.apache.james.protocols.lib.PortUtil;
 import org.apache.james.protocols.lib.mock.MockJSR250Loader;
 import org.apache.james.protocols.lib.mock.MockProtocolHandlerChain;
 import org.apache.james.user.api.UsersRepositoryException;
 import org.apache.james.user.lib.mock.MockUsersRepository;
-import org.apache.james.util.POP3BeforeSMTPHelper;
 
 public class POP3ServerTest extends TestCase {
 

Copied: 
james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/POP3BeforeSMTPHelper.java
 (from r1061130, 
james/server/trunk/util/src/main/java/org/apache/james/util/POP3BeforeSMTPHelper.java)
URL: 
http://svn.apache.org/viewvc/james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/POP3BeforeSMTPHelper.java?p2=james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/POP3BeforeSMTPHelper.javap1=james/server/trunk/util/src/main/java/org/apache/james/util/POP3BeforeSMTPHelper.javar1=1061130r2=1061242rev=1061242view=diff
==
--- 
james/server/trunk/util/src/main/java/org/apache/james/util/POP3BeforeSMTPHelper.java
 (original)
+++ 
james/server/trunk/protocols-library/src/main/java/org/apache/james/protocols/lib/POP3BeforeSMTPHelper.java
 Thu Jan 20 11:48:46 2011
@@ -18,7 +18,7 @@
  /
 
 
-package org.apache.james.util;
+package org.apache.james.protocols.lib;
 
 import java.util.Collections;
 import java.util.HashMap;

Modified: 
james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/POP3BeforeSMTPHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/POP3BeforeSMTPHandler.java?rev=1061242r1=1061241r2=1061242view=diff
==
--- 
james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/POP3BeforeSMTPHandler.java
 (original)
+++ 
james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/POP3BeforeSMTPHandler.java
 Thu Jan 20 11:48:46 2011
@@ -24,8 +24,8 @@ import org.apache.commons.configuration.
 import 

svn commit: r1061244 - in /james/server/trunk/util/src: main/java/org/apache/james/util/InternetPrintWriter.java main/java/org/apache/james/util/POP3BeforeSMTPHelper.java main/java/org/apache/james/ut

2011-01-20 Thread norman
Author: norman
Date: Thu Jan 20 11:50:55 2011
New Revision: 1061244

URL: http://svn.apache.org/viewvc?rev=1061244view=rev
Log:
Remove not used classes. This can be threaded as part of JAMES-1184

Removed:

james/server/trunk/util/src/main/java/org/apache/james/util/InternetPrintWriter.java

james/server/trunk/util/src/main/java/org/apache/james/util/POP3BeforeSMTPHelper.java
james/server/trunk/util/src/main/java/org/apache/james/util/stream/
james/server/trunk/util/src/test/java/org/apache/james/util/stream/


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



svn commit: r1061245 - in /james/server/trunk: smtpserver/src/test/java/org/apache/james/smtpserver/Base64.java smtpserver/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java util/src/main/j

2011-01-20 Thread norman
Author: norman
Date: Thu Jan 20 11:54:11 2011
New Revision: 1061245

URL: http://svn.apache.org/viewvc?rev=1061245view=rev
Log:
move Base64 helper class to smtpserver test as it is only used for it. See 
JAMES-1184

Added:

james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/Base64.java
  - copied, changed from r1061130, 
james/server/trunk/util/src/main/java/org/apache/james/util/codec/Base64.java
Removed:

james/server/trunk/util/src/main/java/org/apache/james/util/codec/Base64.java
Modified:

james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java

Copied: 
james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/Base64.java
 (from r1061130, 
james/server/trunk/util/src/main/java/org/apache/james/util/codec/Base64.java)
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/Base64.java?p2=james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/Base64.javap1=james/server/trunk/util/src/main/java/org/apache/james/util/codec/Base64.javar1=1061130r2=1061245rev=1061245view=diff
==
--- 
james/server/trunk/util/src/main/java/org/apache/james/util/codec/Base64.java 
(original)
+++ 
james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/Base64.java
 Thu Jan 20 11:54:11 2011
@@ -19,7 +19,7 @@
 
 
 
-package org.apache.james.util.codec;
+package org.apache.james.smtpserver;
 
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeUtility;

Modified: 
james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java?rev=1061245r1=1061244r2=1061245view=diff
==
--- 
james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
 (original)
+++ 
james/server/trunk/smtpserver/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
 Thu Jan 20 11:54:11 2011
@@ -54,7 +54,6 @@ import org.apache.james.domainlist.api.m
 import org.apache.james.filesystem.api.mock.MockFileSystem;
 import org.apache.james.mailrepository.mock.MockMailRepositoryStore;
 import org.apache.james.user.lib.mock.MockUsersRepository;
-import org.apache.james.util.codec.Base64;
 import org.apache.james.vut.api.VirtualUserTable;
 import org.apache.james.vut.api.VirtualUserTableException;
 import org.apache.mailet.HostAddress;



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



svn commit: r1061246 - /james/server/trunk/util/src/main/java/org/apache/james/util/codec/

2011-01-20 Thread norman
Author: norman
Date: Thu Jan 20 11:54:52 2011
New Revision: 1061246

URL: http://svn.apache.org/viewvc?rev=1061246view=rev
Log:
Remove empty package

Removed:
james/server/trunk/util/src/main/java/org/apache/james/util/codec/


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



Hudson build is back to stable : james-server-trunk #1010

2011-01-20 Thread Apache Hudson Server
See https://hudson.apache.org/hudson/job/james-server-trunk/1010/changes



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



Re: DB Access with james3

2011-01-20 Thread Luc Saulière
Hello Eric,
That was quite the code I tested yesterday, but I got still the same
exception, because the MailboxManager is not initialized (null pointer
exception).
I tried the @Resource annotation, I got 'null pointer' and I tried the
BeanFactory way but I got a 'bean creation exception'...
I think the first method is the good one, but I'm still looking after the
magic method to instantiate my MailboxManager.

Thx,
Luc.


2011/1/20 Eric Charles e...@apache.org

 Hi,

 Probably you did not instantiate spring context.

 As first shot, you could copy Main to YourMain

 https://svn.apache.org/repos/asf/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/Main.java

 and hack it with for example with code sample in [1].

 You can also hack the spring context xml files if you don't want to load
 all the beans, but you will still need a few of them to access the mailbox.

 Obviously, we could discuss the following:
 1. Add some code simple samples for basic operations on mailbox.
 2. Have a spring context for mailbox that could be used as a stand-alone
 (and also be imported in server).

 Tks,

 Eric

 [1] code sample (non compiling).

 public class YourMain {

private static Log log = LogFactory.getLog(Main.class.getName());

@Ressource(name=mailboxmanager)
private static MailboxManager;

public static void main(String[] args) throws IOException {

final JamesServerApplicationContext context = new
 JamesServerApplicationContext(new String[] {
 context/james-server-context.xml });
context.registerShutdownHook();

// Bad code practice - Refactor it!!!

MailboxPath mailboxPath = MailboxPath.inbox(userName);

MailboxSession mailboxSession =
 mailboxManager.createSystemSession(userName30, log)
mailboxManager.startProcessingRequest(mailboxSession);
try {
mailboxManager.createMailbox(mailboxPath, mailboxSession);
}
catch (MailboxExistsException e) {
// Do nothing, the mailbox already exists.
}

mailboxManager.endProcessingRequest(mailboxSession);


MessageManager messageManager =
 mailboxManager.getMailbox(mailboxPath, mailboxSession);

   // instanciate an input stream that contains your email content
 (body, header,...)

messageManager.appendMessage(your-input-stream,
   new Date(),
   mailboxSession,
   isRecent,
   flags);
   mailboxManager.endProcessingRequest(mailboxSession);
   }

}

 }



 On 19/01/2011 20:07, Luc Saulière wrote:

 Thx for answering so quickly, I tried this in a new package inside
 james-server-container-spring project...
 I have a public static void main(String[] args) containing my private
 staticMailboxManager mailboxManager which

 is injected with the annotation @Resource(name=mailboxmanager) from the
 spring-bean.xml.
 But it does not succeed in initializing the variable and I get a
 NullPointerException as soon as I use it...
 How can I initialize my beans without running the entire James app?

 Tks.


 2011/1/19 Eric Charlese...@apache.org

  Hi Luc,

 Yes, code has changed in trunk since M2 (we don't use MailServer
 anymore).
 In M2, or in trunk, the way to store mail is the same.
 If you are deploying the your code/class in the james spring container,
 you
 need to inject the mailboxmanager (with @Resources(name=mailboxmanager)
 and have a block of code such as:

 MailboxPath mailboxPath = MailboxPath.inbox(userName30);
 MailboxSession mailboxSession =
 mailboxManager.createSystemSession(userName30, log)
 MessageManager messageManager = mailboxManager.getMailbox(mailboxPath,
 mailboxSession);
 messageManager.appendMessage(your-input-stream,
new Date(),
mailboxSession,
isRecent,
flags);
mailboxManager.endProcessingRequest(mailboxSession);
}

 I just realize I can't find a simple test case to in trunk to show this
 (or
 maybe I didn't look good).
 If we don't have this, maybe you could open a jira so we can further
 provide test samples.
 (this comes from  the fact that all our tests were made from an imap
 perspective, we moved the imap test to another  project, but we probably
 should further enrich the pure mailbox test cases/samples).

 Tks,

 Eric




 On 19/01/2011 18:04, Luc Sauličre wrote:

  Hello,
 I'm developing with Math on the same mail app. We didn't succeed in
 storing
 mail as james3 does. In fact the SieveMailet class does not have a
 setUsersRepo method, I think you're dealing with a newer version of
 James3...
 We are developing with the M2 one and SieveMailet have a setMailserver
 method instead.
 So, is there any way to store a mail (from another IMAP connection for
 instance) in the James3 mySQL db, as James3 does (i.e. filling correctly
 all
 the 

Re: DB Access with james3

2011-01-20 Thread Eric Charles

Hi,

Yes, direct injection does not work in main class because it is not 
fetched from spring context.


1. you can create a bean and move the @Resource within, define the bean 
in spring xml context, spring should inject the mailboxmanager in your 
bean. You can get your bean with context.getBean(mybean) in main class.


2. or simply call from the main class context.getBean(mailboxmanager), 
it should give you the mailboxmanager,... but it seems you had an 
exception (if such, could you provide the stack trace ?).


Tks,

Eric


On 20/01/2011 15:42, Luc Saulière wrote:

Hello Eric,
That was quite the code I tested yesterday, but I got still the same
exception, because the MailboxManager is not initialized (null pointer
exception).
I tried the @Resource annotation, I got 'null pointer' and I tried the
BeanFactory way but I got a 'bean creation exception'...
I think the first method is the good one, but I'm still looking after the
magic method to instantiate my MailboxManager.

Thx,
Luc.


2011/1/20 Eric Charlese...@apache.org


Hi,

Probably you did not instantiate spring context.

As first shot, you could copy Main to YourMain

https://svn.apache.org/repos/asf/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/Main.java

and hack it with for example with code sample in [1].

You can also hack the spring context xml files if you don't want to load
all the beans, but you will still need a few of them to access the mailbox.

Obviously, we could discuss the following:
1. Add some code simple samples for basic operations on mailbox.
2. Have a spring context for mailbox that could be used as a stand-alone
(and also be imported in server).

Tks,

Eric

[1] code sample (non compiling).

public class YourMain {

private static Log log = LogFactory.getLog(Main.class.getName());

@Ressource(name=mailboxmanager)
private static MailboxManager;

public static void main(String[] args) throws IOException {

final JamesServerApplicationContext context = new
JamesServerApplicationContext(new String[] {
context/james-server-context.xml });
context.registerShutdownHook();

// Bad code practice - Refactor it!!!

MailboxPath mailboxPath = MailboxPath.inbox(userName);

MailboxSession mailboxSession =
mailboxManager.createSystemSession(userName30, log)
mailboxManager.startProcessingRequest(mailboxSession);
try {
mailboxManager.createMailbox(mailboxPath, mailboxSession);
}
catch (MailboxExistsException e) {
// Do nothing, the mailbox already exists.
}

mailboxManager.endProcessingRequest(mailboxSession);


MessageManager messageManager =
mailboxManager.getMailbox(mailboxPath, mailboxSession);

   // instanciate an input stream that contains your email content
(body, header,...)

messageManager.appendMessage(your-input-stream,
   new Date(),
   mailboxSession,
   isRecent,
   flags);
   mailboxManager.endProcessingRequest(mailboxSession);
   }

}

}



On 19/01/2011 20:07, Luc Saulière wrote:


Thx for answering so quickly, I tried this in a new package inside
james-server-container-spring project...
I have a public static void main(String[] args) containing my private
staticMailboxManager mailboxManager which

is injected with the annotation @Resource(name=mailboxmanager) from the
spring-bean.xml.
But it does not succeed in initializing the variable and I get a
NullPointerException as soon as I use it...
How can I initialize my beans without running the entire James app?

Tks.


2011/1/19 Eric Charlese...@apache.org

  Hi Luc,

Yes, code has changed in trunk since M2 (we don't use MailServer
anymore).
In M2, or in trunk, the way to store mail is the same.
If you are deploying the your code/class in the james spring container,
you
need to inject the mailboxmanager (with @Resources(name=mailboxmanager)
and have a block of code such as:

MailboxPath mailboxPath = MailboxPath.inbox(userName30);
MailboxSession mailboxSession =
mailboxManager.createSystemSession(userName30, log)
MessageManager messageManager = mailboxManager.getMailbox(mailboxPath,
mailboxSession);
messageManager.appendMessage(your-input-stream,
new Date(),
mailboxSession,
isRecent,
flags);
mailboxManager.endProcessingRequest(mailboxSession);
}

I just realize I can't find a simple test case to in trunk to show this
(or
maybe I didn't look good).
If we don't have this, maybe you could open a jira so we can further
provide test samples.
(this comes from  the fact that all our tests were made from an imap
perspective, we moved the imap test to another  project, but we probably
should further enrich the pure mailbox test cases/samples).

Tks,

Eric




On 

Re: DB Access with james3

2011-01-20 Thread Luc Saulière
Ok it works, I didnt know how to inject beans in my main class...
It loads all the james app before sending one mail to the bdd, but it works
:) In fact I hacked all the spring-bean.xml (from J3M2) without deleting any
bean... I just have to select those I need.

Thanks for your help,
Luc

2011/1/20 Eric Charles e...@apache.org

 Hi,

 Yes, direct injection does not work in main class because it is not fetched
 from spring context.

 1. you can create a bean and move the @Resource within, define the bean in
 spring xml context, spring should inject the mailboxmanager in your bean.
 You can get your bean with context.getBean(mybean) in main class.

 2. or simply call from the main class context.getBean(mailboxmanager), it
 should give you the mailboxmanager,... but it seems you had an exception (if
 such, could you provide the stack trace ?).

 Tks,

 Eric



 On 20/01/2011 15:42, Luc Saulière wrote:

 Hello Eric,
 That was quite the code I tested yesterday, but I got still the same
 exception, because the MailboxManager is not initialized (null pointer
 exception).
 I tried the @Resource annotation, I got 'null pointer' and I tried the
 BeanFactory way but I got a 'bean creation exception'...
 I think the first method is the good one, but I'm still looking after the
 magic method to instantiate my MailboxManager.

 Thx,
 Luc.


 2011/1/20 Eric Charlese...@apache.org

  Hi,

 Probably you did not instantiate spring context.

 As first shot, you could copy Main to YourMain


 https://svn.apache.org/repos/asf/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/Main.java

 and hack it with for example with code sample in [1].

 You can also hack the spring context xml files if you don't want to load
 all the beans, but you will still need a few of them to access the
 mailbox.

 Obviously, we could discuss the following:
 1. Add some code simple samples for basic operations on mailbox.
 2. Have a spring context for mailbox that could be used as a stand-alone
 (and also be imported in server).

 Tks,

 Eric

 [1] code sample (non compiling).

 public class YourMain {

private static Log log = LogFactory.getLog(Main.class.getName());

@Ressource(name=mailboxmanager)
private static MailboxManager;

public static void main(String[] args) throws IOException {

final JamesServerApplicationContext context = new
 JamesServerApplicationContext(new String[] {
 context/james-server-context.xml });
context.registerShutdownHook();

// Bad code practice - Refactor it!!!

MailboxPath mailboxPath = MailboxPath.inbox(userName);

MailboxSession mailboxSession =
 mailboxManager.createSystemSession(userName30, log)
mailboxManager.startProcessingRequest(mailboxSession);
try {
mailboxManager.createMailbox(mailboxPath, mailboxSession);
}
catch (MailboxExistsException e) {
// Do nothing, the mailbox already exists.
}

mailboxManager.endProcessingRequest(mailboxSession);


MessageManager messageManager =
 mailboxManager.getMailbox(mailboxPath, mailboxSession);

   // instanciate an input stream that contains your email content
 (body, header,...)

messageManager.appendMessage(your-input-stream,
   new Date(),
   mailboxSession,
   isRecent,
   flags);
   mailboxManager.endProcessingRequest(mailboxSession);
   }

}

 }



 On 19/01/2011 20:07, Luc Saulière wrote:

  Thx for answering so quickly, I tried this in a new package inside
 james-server-container-spring project...
 I have a public static void main(String[] args) containing my private
 staticMailboxManager mailboxManager which

 is injected with the annotation @Resource(name=mailboxmanager) from
 the
 spring-bean.xml.
 But it does not succeed in initializing the variable and I get a
 NullPointerException as soon as I use it...
 How can I initialize my beans without running the entire James app?

 Tks.


 2011/1/19 Eric Charlese...@apache.org

  Hi Luc,

 Yes, code has changed in trunk since M2 (we don't use MailServer
 anymore).
 In M2, or in trunk, the way to store mail is the same.
 If you are deploying the your code/class in the james spring container,
 you
 need to inject the mailboxmanager (with
 @Resources(name=mailboxmanager)
 and have a block of code such as:

 MailboxPath mailboxPath = MailboxPath.inbox(userName30);
 MailboxSession mailboxSession =
 mailboxManager.createSystemSession(userName30, log)
 MessageManager messageManager = mailboxManager.getMailbox(mailboxPath,
 mailboxSession);
 messageManager.appendMessage(your-input-stream,
new Date(),
mailboxSession,
isRecent,
flags);
mailboxManager.endProcessingRequest(mailboxSession);
}

 I just realize I can't 

Re: DB Access with james3

2011-01-20 Thread Norman Maurer
Hi there,

exactly. In fact you will prolly only need to instance the needed
MailboxManager/SubscriptionManager/Authenticator implementation you
want to use in your code or just wire these implementations via
spring. Everything else should not be needed.

Bye,
Norman


2011/1/20 Luc Saulière luc.sauli...@gmail.com:
 Ok it works, I didnt know how to inject beans in my main class...
 It loads all the james app before sending one mail to the bdd, but it works
 :) In fact I hacked all the spring-bean.xml (from J3M2) without deleting any
 bean... I just have to select those I need.

 Thanks for your help,
 Luc

 2011/1/20 Eric Charles e...@apache.org

 Hi,

 Yes, direct injection does not work in main class because it is not fetched
 from spring context.

 1. you can create a bean and move the @Resource within, define the bean in
 spring xml context, spring should inject the mailboxmanager in your bean.
 You can get your bean with context.getBean(mybean) in main class.

 2. or simply call from the main class context.getBean(mailboxmanager), it
 should give you the mailboxmanager,... but it seems you had an exception (if
 such, could you provide the stack trace ?).

 Tks,

 Eric



 On 20/01/2011 15:42, Luc Saulière wrote:

 Hello Eric,
 That was quite the code I tested yesterday, but I got still the same
 exception, because the MailboxManager is not initialized (null pointer
 exception).
 I tried the @Resource annotation, I got 'null pointer' and I tried the
 BeanFactory way but I got a 'bean creation exception'...
 I think the first method is the good one, but I'm still looking after the
 magic method to instantiate my MailboxManager.

 Thx,
 Luc.


 2011/1/20 Eric Charlese...@apache.org

  Hi,

 Probably you did not instantiate spring context.

 As first shot, you could copy Main to YourMain


 https://svn.apache.org/repos/asf/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/Main.java

 and hack it with for example with code sample in [1].

 You can also hack the spring context xml files if you don't want to load
 all the beans, but you will still need a few of them to access the
 mailbox.

 Obviously, we could discuss the following:
 1. Add some code simple samples for basic operations on mailbox.
 2. Have a spring context for mailbox that could be used as a stand-alone
 (and also be imported in server).

 Tks,

 Eric

 [1] code sample (non compiling).

 public class YourMain {

    private static Log log = LogFactory.getLog(Main.class.getName());

    @Ressource(name=mailboxmanager)
    private static MailboxManager;

    public static void main(String[] args) throws IOException {

        final JamesServerApplicationContext context = new
 JamesServerApplicationContext(new String[] {
 context/james-server-context.xml });
        context.registerShutdownHook();

        // Bad code practice - Refactor it!!!

        MailboxPath mailboxPath = MailboxPath.inbox(userName);

        MailboxSession mailboxSession =
 mailboxManager.createSystemSession(userName30, log)
        mailboxManager.startProcessingRequest(mailboxSession);
        try {
                mailboxManager.createMailbox(mailboxPath, mailboxSession);
        }
        catch (MailboxExistsException e) {
                // Do nothing, the mailbox already exists.
        }

        mailboxManager.endProcessingRequest(mailboxSession);


        MessageManager messageManager =
 mailboxManager.getMailbox(mailboxPath, mailboxSession);

       // instanciate an input stream that contains your email content
 (body, header,...)

        messageManager.appendMessage(your-input-stream,
                       new Date(),
                       mailboxSession,
                       isRecent,
                       flags);
               mailboxManager.endProcessingRequest(mailboxSession);
           }

    }

 }



 On 19/01/2011 20:07, Luc Saulière wrote:

  Thx for answering so quickly, I tried this in a new package inside
 james-server-container-spring project...
 I have a public static void main(String[] args) containing my private
 staticMailboxManager mailboxManager which

 is injected with the annotation @Resource(name=mailboxmanager) from
 the
 spring-bean.xml.
 But it does not succeed in initializing the variable and I get a
 NullPointerException as soon as I use it...
 How can I initialize my beans without running the entire James app?

 Tks.


 2011/1/19 Eric Charlese...@apache.org

  Hi Luc,

 Yes, code has changed in trunk since M2 (we don't use MailServer
 anymore).
 In M2, or in trunk, the way to store mail is the same.
 If you are deploying the your code/class in the james spring container,
 you
 need to inject the mailboxmanager (with
 @Resources(name=mailboxmanager)
 and have a block of code such as:

 MailboxPath mailboxPath = MailboxPath.inbox(userName30);
 MailboxSession mailboxSession =
 mailboxManager.createSystemSession(userName30, log)
 MessageManager messageManager = 

[jira] Commented: (JAMES-1183) Error during initial request parsing

2011-01-20 Thread Norman Maurer (JIRA)

[ 
https://issues.apache.org/jira/browse/JAMES-1183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12984332#action_12984332
 ] 

Norman Maurer commented on JAMES-1183:
--

Any progress ;) ?

 Error during initial request parsing
 

 Key: JAMES-1183
 URL: https://issues.apache.org/jira/browse/JAMES-1183
 Project: JAMES Server
  Issue Type: Bug
  Components: IMAPServer
Affects Versions: 3.0-M3
 Environment: Centos AMD Dual-Core 2.6 gHz 4GB RAM
Reporter: Myron L Stewart
 Fix For: 3.0-M3

 Attachments: partial_wrapper.log


 I am noticing issues off and on when I try to copy messages offline into a 
 mailbox folder via IMAP. James throws and error:
 
 DEBUG 18:20:28,945 | james.imapserver | Error during initial request parsing
 org.apache.james.imap.decode.DecodingException: Missing argument.
   at 
 org.apache.james.imap.decode.ImapRequestLineReader.nextWordChar(ImapRequestLineReader.java:58)
   at 
 org.apache.james.imap.decode.base.AbstractImapCommandParser.consumeWord(AbstractImapCommandParser.java:296)
   at 
 org.apache.james.imap.decode.base.AbstractImapCommandParser.atom(AbstractImapCommandParser.java:149)
   at 
 org.apache.james.imap.decode.main.DefaultImapDecoder.decodeCommandTagged(DefaultImapDecoder.java:83)
   at 
 org.apache.james.imap.decode.main.DefaultImapDecoder.decode(DefaultImapDecoder.java:61)
   at 
 org.apache.james.imap.main.AbstractImapRequestHandler.doProcessRequest(AbstractImapRequestHandler.java:62)
   at 
 org.apache.james.imap.main.ImapRequestStreamHandler.handleRequest(ImapRequestStreamHandler.java:82)
   at 
 org.apache.james.imapserver.netty.ImapStreamChannelUpstreamHandler.processStreamIo(ImapStreamChannelUpstreamHandler.java:88)
   at 
 org.jboss.netty.handler.stream.StreamHandler$1.run(StreamHandler.java:127)
   at 
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at 
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)
 DEBUG 18:20:28,946 | james.imapserver | Cannot parse tag
 org.apache.james.imap.decode.DecodingException: Missing argument.
   at 
 org.apache.james.imap.decode.ImapRequestLineReader.nextWordChar(ImapRequestLineReader.java:58)
   at 
 org.apache.james.imap.decode.base.AbstractImapCommandParser.consumeWord(AbstractImapCommandParser.java:296)
   at 
 org.apache.james.imap.decode.base.AbstractImapCommandParser.tag(AbstractImapCommandParser.java:158)
   at 
 org.apache.james.imap.decode.main.DefaultImapDecoder.decode(DefaultImapDecoder.java:60)
   at 
 org.apache.james.imap.main.AbstractImapRequestHandler.doProcessRequest(AbstractImapRequestHandler.java:62)
   at 
 org.apache.james.imap.main.ImapRequestStreamHandler.handleRequest(ImapRequestStreamHandler.java:82)
   at 
 org.apache.james.imapserver.netty.ImapStreamChannelUpstreamHandler.processStreamIo(ImapStreamChannelUpstreamHandler.java:88)
   at 
 org.jboss.netty.handler.stream.StreamHandler$1.run(StreamHandler.java:127)
   at 
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at 
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)
 
 It seems like james does not like certain tags. I've seen it complain about 
 html tags too. Do not know if this is fixed or if someone is working on it. 
 Trying to gather more information to see exact causes or what sort of e-mails 
 cause james to throw this error.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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



[jira] Resolved: (JAMES-1067) Remove dependency on commons-oro

2011-01-20 Thread Stefano Bagnara (JIRA)

 [ 
https://issues.apache.org/jira/browse/JAMES-1067?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefano Bagnara resolved JAMES-1067.


   Resolution: Fixed
Fix Version/s: (was: 3.0)
   3.0-M3

 Remove dependency on commons-oro
 

 Key: JAMES-1067
 URL: https://issues.apache.org/jira/browse/JAMES-1067
 Project: JAMES Server
  Issue Type: Task
Reporter: Norman Maurer
Assignee: Stefano Bagnara
 Fix For: 3.0-M3


 We have a few classes which use commons oro. The dependency should get 
 removed because commons oro was moved to the attic.
 See:
 http://jakarta.apache.org/site/news/news-2010-q3.html#20100901.2 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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



svn commit: r1061553 - /james/mailet/current/

2011-01-20 Thread bago
Author: bago
Date: Thu Jan 20 22:36:32 2011
New Revision: 1061553

URL: http://svn.apache.org/viewvc?rev=1061553view=rev
Log:
remove site and project external links from current

Modified:
james/mailet/current/   (props changed)

Propchange: james/mailet/current/
--
--- svn:externals (original)
+++ svn:externals Thu Jan 20 22:36:32 2011
@@ -3,5 +3,3 @@ basehttps://svn.apache.org/repos/asf/ja
 crypto https://svn.apache.org/repos/asf/james/mailet/crypto/trunk
 standard https://svn.apache.org/repos/asf/james/mailet/standard/trunk
 maven-mailetdocs-plugin 
https://svn.apache.org/repos/asf/james/mailet/maven-mailetdocs-plugin/trunk
-james-project 
http://svn.apache.org/repos/asf/james/project/tags/james-parent-1.2
-site https://svn.apache.org/repos/asf/james/site/trunk/www/mailet



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



[jira] Commented: (JAMES-1183) Error during initial request parsing

2011-01-20 Thread Myron L Stewart (JIRA)

[ 
https://issues.apache.org/jira/browse/JAMES-1183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12984596#action_12984596
 ] 

Myron L Stewart commented on JAMES-1183:


Looks like it will be more like this weekend before I complete my tests. This 
cold hit me harder than I wanted to. :-)

 Error during initial request parsing
 

 Key: JAMES-1183
 URL: https://issues.apache.org/jira/browse/JAMES-1183
 Project: JAMES Server
  Issue Type: Bug
  Components: IMAPServer
Affects Versions: 3.0-M3
 Environment: Centos AMD Dual-Core 2.6 gHz 4GB RAM
Reporter: Myron L Stewart
 Fix For: 3.0-M3

 Attachments: partial_wrapper.log


 I am noticing issues off and on when I try to copy messages offline into a 
 mailbox folder via IMAP. James throws and error:
 
 DEBUG 18:20:28,945 | james.imapserver | Error during initial request parsing
 org.apache.james.imap.decode.DecodingException: Missing argument.
   at 
 org.apache.james.imap.decode.ImapRequestLineReader.nextWordChar(ImapRequestLineReader.java:58)
   at 
 org.apache.james.imap.decode.base.AbstractImapCommandParser.consumeWord(AbstractImapCommandParser.java:296)
   at 
 org.apache.james.imap.decode.base.AbstractImapCommandParser.atom(AbstractImapCommandParser.java:149)
   at 
 org.apache.james.imap.decode.main.DefaultImapDecoder.decodeCommandTagged(DefaultImapDecoder.java:83)
   at 
 org.apache.james.imap.decode.main.DefaultImapDecoder.decode(DefaultImapDecoder.java:61)
   at 
 org.apache.james.imap.main.AbstractImapRequestHandler.doProcessRequest(AbstractImapRequestHandler.java:62)
   at 
 org.apache.james.imap.main.ImapRequestStreamHandler.handleRequest(ImapRequestStreamHandler.java:82)
   at 
 org.apache.james.imapserver.netty.ImapStreamChannelUpstreamHandler.processStreamIo(ImapStreamChannelUpstreamHandler.java:88)
   at 
 org.jboss.netty.handler.stream.StreamHandler$1.run(StreamHandler.java:127)
   at 
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at 
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)
 DEBUG 18:20:28,946 | james.imapserver | Cannot parse tag
 org.apache.james.imap.decode.DecodingException: Missing argument.
   at 
 org.apache.james.imap.decode.ImapRequestLineReader.nextWordChar(ImapRequestLineReader.java:58)
   at 
 org.apache.james.imap.decode.base.AbstractImapCommandParser.consumeWord(AbstractImapCommandParser.java:296)
   at 
 org.apache.james.imap.decode.base.AbstractImapCommandParser.tag(AbstractImapCommandParser.java:158)
   at 
 org.apache.james.imap.decode.main.DefaultImapDecoder.decode(DefaultImapDecoder.java:60)
   at 
 org.apache.james.imap.main.AbstractImapRequestHandler.doProcessRequest(AbstractImapRequestHandler.java:62)
   at 
 org.apache.james.imap.main.ImapRequestStreamHandler.handleRequest(ImapRequestStreamHandler.java:82)
   at 
 org.apache.james.imapserver.netty.ImapStreamChannelUpstreamHandler.processStreamIo(ImapStreamChannelUpstreamHandler.java:88)
   at 
 org.jboss.netty.handler.stream.StreamHandler$1.run(StreamHandler.java:127)
   at 
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at 
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)
 
 It seems like james does not like certain tags. I've seen it complain about 
 html tags too. Do not know if this is fixed or if someone is working on it. 
 Trying to gather more information to see exact causes or what sort of e-mails 
 cause james to throw this error.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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



[jira] Commented: (JAMES-1183) Error during initial request parsing

2011-01-20 Thread Norman Maurer (JIRA)

[ 
https://issues.apache.org/jira/browse/JAMES-1183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12984597#action_12984597
 ] 

Norman Maurer commented on JAMES-1183:
--

No problem.. Take your time.

Would be nice if you could attach the email which cause the problem to the 
issue if its still happen (not sure if its possilbe)

 Error during initial request parsing
 

 Key: JAMES-1183
 URL: https://issues.apache.org/jira/browse/JAMES-1183
 Project: JAMES Server
  Issue Type: Bug
  Components: IMAPServer
Affects Versions: 3.0-M3
 Environment: Centos AMD Dual-Core 2.6 gHz 4GB RAM
Reporter: Myron L Stewart
 Fix For: 3.0-M3

 Attachments: partial_wrapper.log


 I am noticing issues off and on when I try to copy messages offline into a 
 mailbox folder via IMAP. James throws and error:
 
 DEBUG 18:20:28,945 | james.imapserver | Error during initial request parsing
 org.apache.james.imap.decode.DecodingException: Missing argument.
   at 
 org.apache.james.imap.decode.ImapRequestLineReader.nextWordChar(ImapRequestLineReader.java:58)
   at 
 org.apache.james.imap.decode.base.AbstractImapCommandParser.consumeWord(AbstractImapCommandParser.java:296)
   at 
 org.apache.james.imap.decode.base.AbstractImapCommandParser.atom(AbstractImapCommandParser.java:149)
   at 
 org.apache.james.imap.decode.main.DefaultImapDecoder.decodeCommandTagged(DefaultImapDecoder.java:83)
   at 
 org.apache.james.imap.decode.main.DefaultImapDecoder.decode(DefaultImapDecoder.java:61)
   at 
 org.apache.james.imap.main.AbstractImapRequestHandler.doProcessRequest(AbstractImapRequestHandler.java:62)
   at 
 org.apache.james.imap.main.ImapRequestStreamHandler.handleRequest(ImapRequestStreamHandler.java:82)
   at 
 org.apache.james.imapserver.netty.ImapStreamChannelUpstreamHandler.processStreamIo(ImapStreamChannelUpstreamHandler.java:88)
   at 
 org.jboss.netty.handler.stream.StreamHandler$1.run(StreamHandler.java:127)
   at 
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at 
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)
 DEBUG 18:20:28,946 | james.imapserver | Cannot parse tag
 org.apache.james.imap.decode.DecodingException: Missing argument.
   at 
 org.apache.james.imap.decode.ImapRequestLineReader.nextWordChar(ImapRequestLineReader.java:58)
   at 
 org.apache.james.imap.decode.base.AbstractImapCommandParser.consumeWord(AbstractImapCommandParser.java:296)
   at 
 org.apache.james.imap.decode.base.AbstractImapCommandParser.tag(AbstractImapCommandParser.java:158)
   at 
 org.apache.james.imap.decode.main.DefaultImapDecoder.decode(DefaultImapDecoder.java:60)
   at 
 org.apache.james.imap.main.AbstractImapRequestHandler.doProcessRequest(AbstractImapRequestHandler.java:62)
   at 
 org.apache.james.imap.main.ImapRequestStreamHandler.handleRequest(ImapRequestStreamHandler.java:82)
   at 
 org.apache.james.imapserver.netty.ImapStreamChannelUpstreamHandler.processStreamIo(ImapStreamChannelUpstreamHandler.java:88)
   at 
 org.jboss.netty.handler.stream.StreamHandler$1.run(StreamHandler.java:127)
   at 
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at 
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)
 
 It seems like james does not like certain tags. I've seen it complain about 
 html tags too. Do not know if this is fixed or if someone is working on it. 
 Trying to gather more information to see exact causes or what sort of e-mails 
 cause james to throw this error.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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