Hi Mohammad,
That's really great to have you developing with james.
To debug server and imap, simply import all (server+imap) maven projects
in the same workspace.
You need to launch the Main class in a debug mode (see eclipse tutorials
for that).
Set a breakpoint where you like (for example somewhere in the pop3/smtp
server classes) and send/read mail.
For the place of mapping files, I went back to openjpa doc
http://openjpa.apache.org/builds/latest/docs/manual/manual.html to read
(snip)
Persistence metadata is specified using either the Java 5 annotations
defined in the |javax.persistence| package, XML mapping files, or a
mixture of both. In the latter case, XML declarations override
conflicting annotations. If you choose to use XML metadata, the XML
files must be available at development and runtime, and must be
discoverable via either of two strategies:
1.
In a resource named |orm.xml| placed in a |META-INF| directory
within a directory in your classpath or within a ( jar archive
containing your persistent classes.
2.
Declared in your |persistence.xml|
<http://openjpa.apache.org/builds/latest/docs/manual/manual.html#jpa_overview_persistence_xml>
configuration file. In this case, each XML metadata file must be
listed in a |mapping-file| element whose content is either a path to
the given file or a resource location available to the class' class
loader.
(snip)
The first important point is that annotation and mapping files can
coexist, the mapping file taking the precedence
So i would leave the annotations in any case in the classes to still be
able to run the tests (in imap/jpa, server/user-jpa,
server/domainlist-jpa, you need to have "mvn test").
The second point is that you can define in META-INF/persistence.xml, the
place of the file (on disk, or on classpath).
Your suggestion to have the mapping files in conf/jpa/ folder sounds good.
I would simply add in persistence.xml a link to the files
"../conf/jpa/....xml, in a deployment mode, for now, we can use relative
paths.
The default package be to rely on the annotations (so commented mapping
files commented in persistence.xml). Up-to the developer to uncomment in
persistence.xml and modify the files.
You could be interrested in
http://stackoverflow.com/questions/690155/tutorial-on-jpa-mapping-file
to automatically generate the mapping files from existing annotations.
!!! Take care with jpa/maven/eclipse combination. A change in a jpa
annotation is not taken into account or simply freeze james runtime...
So go for the mvn install way for jpa change.
Tks,
Eric
On 21/11/2010 20:29, Mohammad Naghavi wrote:
Hi there,
I'm an student right now but I'm doing my best to learn Jame's structure as
fast as possible for a project.
about the first point, what I wanted to know was actually how to debug both
server and imap together? because I have checked out each of them from
different directories of code repository and I don't know how they should be
put together to be compiled together and debugged together. I have actually
imported each of them in separated workspaces in eclipse.
thanks for the complete answer of the second question.
MN
________________________________________
PHP& ASP .Net 3.5 web developer
Java& C# desktop developer
www.mohamnag.com
On Sun, Nov 21, 2010 at 8:13 PM, Eric Charles<[email protected]> wrote:
Hi Mohammad,
Glad to read your are progressing.
1. If you run compiled server+imap in eclipse and run james main class from
within eclipse, you can debug it just like any other java application.
Instead of selecting "Run as...", select "Debug as..." (btw, I will add a
section on the web page).
2. I would say, start with the mapping files in the same package as the
domain classes (but in src/main/resources, otherwise they won't be taken
into account in the build) - we will arrange to change their place with
infra code once you will be ok (we are used to move stuff :)
Maven and Eclipse are great friends,... except for JPA... When changing JPA
annotations in domain classes, I have to "mvn install", and let the
container-spring project depend on the locally installed jar (in other
words, "resolve dependency in workspace" sucks for JPA).
Tks,
Eric
On 21/11/2010 19:30, Mohammad Naghavi wrote:
Hi every body,
after compiling the James and IMAP fom the SVN and learning somethings
about
JPA, I wanted to start moving the persistence related data out of class
definitions but as I'm completely new to both James and JPA these two
questions came to me. it would be very great to help me finding an answer
for them:
1. I know how to run James which I checked out from *
https://svn.apache.org/repos/asf/james/server/trunk* and also know how to
compile IMAP from *https://svn.apache.org/repos/asf/james/imap/trunk *but
is
it also possible to debug both of them (I mean IMAP in server) from
Eclipse
or I have to depend on just log data for debuging?
2. Second question which came to my mind was where shall I put meta data
map-file for JPA? this is places in the same folder as the class itself in
tutorial but can I put it there? how would it be copied to output? a great
place for output position would be a new folder under conf folder like:
conf\JPA\mapfilename.xml but how is it organised to be copied there in
Maven
projects?
thanks to any respond.
MN
________________________________________
PHP& ASP .Net 3.5 web developer
Java& C# desktop developer
www.mohamnag.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]