понедельник, 14 февраля 2011 г.

SVN on Mac OS X in 10 steps.

1. Download Subversion DMG from
2. Setup Subversion
3. $ sudo mkdir /usr/local/svn
$ sudo svnadmin create /usr/local/svn/[PROJECT_NAME]
$ sudo chown -R www /usr/local/svn
4. Create httpd.conf on the base of content of /etc/apache2/httpd.conf
5. Add to LoadModule section
LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so
At end of the file, add this include
Include /private/etc/apache2/extra/httpd-svn.conf
Copy edited file to /etc/apache2/httpd.conf, overwrite
6. Create /etc/apache2/extra/httpd-svn.conf with following content:
<Location /svn>

DAV svn
SVNParentPath /usr/local/svn

# how to authenticate a user
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /etc/apache2/subversion.auth
# only authenticated users may access the repository
Require valid-user
</Location>

7. $ sudo htpasswd -cm /etc/apache2/subversion.auth [USER_NAME] and create password for the user
8. Stop and start Apache server using apachectl or by un-checking and checking the Web Sharing checkbox in System Preferences > Sharing.
9. To access SVN, the URL is http://localhost/svn/[PROJECT_NAME]. The configuration is using SVN ParentPath configuration which means that you can have multiple repositories in /usr/local/svn (e.g. project1, project2, etc)
10. Setup SVN in Eclipse/STS, type following path: http://localhost/svn/[PROJECT_NAME], enter [USER_NAME] credentials.

четверг, 3 февраля 2011 г.

GWT + Roo + MySQL: Special & Cyrillic characters in UTF8

Defaut app generated by Roo persisting special & Cyrillic characters not correctly, as '???'. To fix that, update generated database.properties file:

database.url=jdbc\:mysql\://localhost\:3306/[YOUR_DB_NAME]?autoReconnect\=true&useUnicode\=true&characterEncoding\=UTF-8

GWT. Collection fields

For example, you have something like:

@Entity
public class Contact {
...
@OneToMany(mappedBy="contact", targetEntity=Tag.class, fetch=FetchType.EAGER)
private List tags;
...
}

On first look, when you fetching contacts, their 'tags' fields should be already prepopulated... as they annotated as eager... But then you'll try to execute something like:

requestFactory.contactRequest().findAllContacts().fire(lastDataReceiver);

all 'tags' will be NULL.

To fetch collection fields together with parent entity you have to use:
requestFactory.contactRequest().findAllContacts().with("tags").fire(lastDataReceiver);

Spring ROO + GWT. Back-end.

Playing with Spring Roo and GWT 2.1.1 plugin... Sometimes like it, sometimes - not. It's a long story, I'll concentrate on some tricky points...

It was not clear for me, how they implementing back-end stuff, as there are no any code in entity classes, as it usually appears in GWT examples. I found what Roo generates all back-end as AspectJ classes paced into same package as an entity. They are Roo-managed and not intended to be modified... If you need some special methods, you may create them in the entity class, Roo will not overwrite your code.

The tricky point - STS hide such files, .aj, by default. To show them, go to drop-down menu in Package Explorer in STS -> Filters... -> uncheck "Hide generated Spring Roo ITDs".