05 November 2010

Test syntax and xml publishing

Bambitroll @ 15:40
Use this little page to format the XML code for you


#! /bin/env python
def python_funct():
   a = a + b
   print "Hello Highlighted code"

class Foo(Bar):
   pass


<Location /svn>

  # Uncomment this to enable the repository
  DAV svn

  # The following three lines allow anonymous read, but make
  # committers authenticate themselves.  It requires the 'authz_user'
  # module (enable it with 'a2enmod').
  #<LimitExcept GET PROPFIND OPTIONS REPORT>
  Require valid-user
  #</LimitExcept> 

</Location>

23 August 2010

How to update Smooks in JBoss ESB

Bambitroll @ 10:51
The latest JBoss SOA platform (5.0) uses JBoss ESB 4.7 (https://www.jboss.com/products/platforms/soa/components/) which itself uses Smooks 1.2.3 (http://docs.jboss.org/jbossesb/docs/4.7/manuals/html/ReleaseNotes.html)
The latest and greatest Smooks is 1.3.1 and contains certain new features.
So if you absolutely need them in your JBoss Soa Platform 5.0, you will have to update Smooks manually. To do so, download the zip file from http://downloads.sourceforge.net/smooks/smooks-1.3.1.zip, unpack it and replace all the milyn-* from $JBOSS_ESB_HOME/server/default/deployers/esb.deployer/lib/ with the ones from the lib folder in the zip file.

Warning: This configuration is most likely not supported in case you need support from Red Hat.

14 June 2010

Agilo for Scrum

Bambitroll @ 15:29
I found a tool called Agilo (built on of Trac) which looks promising as a Scrum tool. It supports most of the Scrum features and is actually quite nice to use.

Here is a description regarding how to install Agilo

I used a lot of information from the following pages (mostly for Hardy but can be reused):
 http://trac.edgewall.org/wiki/0.11/TracOnUbuntu
 http://trac.edgewall.org/wiki/0.10.4/TracOnUbuntuHardy
 http://trac.edgewall.org/wiki/TracUbuntuMultipleProjects
 http://anantgarg.com/2009/03/25/subversion-trac-multiple-projects/
 http://www.agile42.com/cms/pages/download-install/
 http://specialbrands.net/2010/01/12/agilo-a-scrum-tool-agile-scrum/

Now for the step by step install (all commands are run as root!):

We start from a fresh Ubuntu 10.04 Lucid Lynx server

First we add Apache and some tools

apt-get install apache2 libapache2-mod-python libapache2-svn python-setuptools subversion python-subversion python-simplejson

Then we install trac

apt-get install trac

Then we configure Trac

mkdir /var/lib/trac
chown www-data:www-data /var/lib/trac
ln -s /var/lib/trac/ /trac
vi /etc/apache2/sites-available/trac and add this:

<VirtualHost *>
ServerAdmin user@email.com
ServerName you.servername.com
DocumentRoot /var/www
ErrorLog /var/log/apache2/error.trac.log
CustomLog /var/log/apache2/access.trac.log combined

<location /trac>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /var/lib/trac
PythonOption TracUriRoot /trac
PythonOption PYTHON_EGG_CACHE /tmp
</location>
# use the following for one authorization for all projects 
# (names containing "-" are not detected):
<LocationMatch "/trac/[[:alnum:]]+/login">
AuthType Basic
AuthName "trac"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</LocationMatch>
</VirtualHost *>

a2dissite default
a2ensite trac
/etc/init.d/apache2 reload

Then we configure SVN:

mkdir /var/lib/svn
svnadmin create /var/lib/svn/theproject
chown -R www-data /var/lib/svn


Then we create the Trac site for the project:

trac-admin /var/lib/trac/theproject initenv
chown -R www-data /var/lib/trac
vi /etc/apache2/mods-available/dav_svn.conf and add this:

<location /svn>
# Uncomment this to enable the repository
DAV svn

# Set this to the path to your repository
#SVNPath /var/lib/svn
# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
# You need either SVNPath and SVNParentPath, but not both.
SVNParentPath /var/lib/svn
#Provides directory listing of repositories
SVNListParentPath On

# Basic Authentication is repository-wide.  It is not secure unless
# you are using https.  See the 'htpasswd' command to create and
# manage the password file - and the documentation for the
# 'auth_basic' and 'authn_file' modules, which you will need for this
# (enable them with 'a2enmod').
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
AuthzSVNAccessFile /etc/apache2/authz_svn.access

Require valid-user
</location>

/etc/init.d/apache2 reload


Now Agilo

Download and unpack Agilo Source Code and then run:
python setup.py install
vi /trac/theproject/conf/trac.ini and make sure that you have these lines

[components]
agilo.* = enabled
webadmin.* = enabled

Then run:
trac-admin /var/lib/trac/theproject upgrade
/etc/init.d/apache2 reload

Add the AccountManager plugin  http://trac-hacks.org/wiki/AccountManagerPlugin

Then you have to configure the access control for Trac (we use the same users for SVN and Trac):
htpasswd -cm /etc/apache2/dav_svn.passwd - NB: the -c creates the file so use it only once
vi /etc/apache2/authz_svn.access and have something like this:

[theproject:/]
theuser = rw


trac-admin /trac/theproject permission remove anonymous BROWSER_VIEW CHANGESET_VIEW FILE_VIEW LOG_VIEW MILESTONE_VIEW REPORT_SQL_VIEW REPORT_VIEW ROADMAP_VIEW SEARCH_VIEW TICKET_CREATE TICKET_MODIFY TICKET_VIEW TIMELINE_VIEW WIKI_CREATE WIKI_MODIFY WIKI_VIEW
trac-admin /trac/theproject permission add TRAC_ADMIN theadminuser
/etc/init.d/apache2 restart

YOU ARE DONE!

How to add new users (as root):
htpasswd -m /etc/apache2/dav_svn.passwd theuser (use -c for the first time to create the file)
vi /etc/apache2/authz_svn.access and add the new user there with rw
/etc/init.d/apache2 reload
trac-admin /trac/theproject permission add theuser the_perm with THE_PERM being TEAM_MEMBER, PRODUCT_OWNER, SCRUM_MASTER or TRAC_ADMIN

How to increase the default attachment size for documents the wiki
Change max_size value in the [attachment] section of the trac.ini of your site
More info on the online doc which comes with every new Trac site!

24 March 2010

JBoss and web-console

Bambitroll @ 11:06
I have been fighting with my JBoss 4.3 for a good hour now just because I want to access the web console located at htpp://localhost:8080/web-console/.
The problem is that no matter what I set for the user in the config file, it is not taken into account.
So here is how I got it to work:
- Go to $JBOSS_HOME/server/default/conf/props
- Add the files web-console-users.properties and web-console-roles.properties
- Edit  $JBOSS_HOME/server/default/conf/login-config.xml and make sure that the path to the 2 files above looks like props/web-console-*.properties.

For some fishy reasons, if you have the files right under conf/ and login-config.xml properly referring to them, it will not work. You have to have them in conf/props/ and update the reference in login-config.xml.

16 March 2010

Seamgen to Maven

Bambitroll @ 17:51
As a follow-up of my previous post, I generated a Seam 2.1.2 project via seamgen and tried to make it work in the maven structure I made earlier.
The biggest problem was with the config files and have richfaces properly working. But I managed and the tar of the project is here.

The files I had to change where persistence.xml, pages.xml, web/pom.xml, web.xml and components.xml.

Now download it, unpack, copy your Java classes and webapp generated by seamgen where they belong, run "mvn clean install package" and you should be able to deploy the .ear file without any problems (given that you have the corresponding *ds.xml file)

10 March 2010

Seam 2.0 and Maven

Bambitroll @ 16:54
Since I am playing with Maven and Seam, I had to manage to create a Seam 2.0 project which can be built with Maven (Seam 3.0 will be fully mavenized).

So here is what I found...
All you need to know is here:
http://seamframework.org/Documentation/IsThereAMaven2ProjectTemplateForSeamApplications

The first link (http://kasper.eobjects.dk/2009/04/seam-ejbs-and-ear-packaging-in-maven.html) works out of the box and uses sub-projects for the different modules (and Eclipse is ok with that!) but I am a bit unsure regarding the test part. It should work fine from the command line though.

The second link (http://www.smies.com/blog/?p=30) seems to have the test part built in but I have not tested it yet. It also uses a flat structure for the project which is a bit less nice...

So after a bit of work, I improved Kasper's setup so that the project now has a persistence unit defined (remember to add a proper *ds.xml file in your deploy folder) and is also able to do some sort of hot-deploy. You can get the tar file here.


For the hot-deploy part, I used something described here (http://relation.to/Bloggers/FastAndIncrementalPackagingInJBossTools) which copies files automatically upon changes from your workspace to your deploy folder (or any other folder of your choosing) according to some rules so you can filter the files you do not want.
This JBoss Tools might be interesting in other cases as well...

So to have the hot-deploy working, I configured the Project archives like this:
- one exploded archive for the ear
- one exploded archive for the jar, exploded inside the ear above
- one exploded archive for the war, exploded inside the ear above, and with 2 file sets (one taking all from web/src/main/webapp (aka the xhtml files) and the other taking all from web/target/JMSeamExample-web-1.0 minus **/*.*html (basically only the libs)).
An explanatory picture can be found here.

If one changes a Java class, the best is to right click on the project in Project archives and choose "Build full" to force a redeploy. Otherwise for xhtml files it happens by itself.
I know it is not has seamless as with the out of the box seam-gen integration but it is not too bad.