Quintessential Nexus installation and maven repository configuration

Fortunately there is the Maven handbook [1]. Unfortunately you had to
know that it exists, or you risk to deal with the complete but huge
Nexus documentation. What you need to run a Nexus server is what
follows, giving that you already have JRE and a servlet container
installed (I use Jetty here)

cd $JETTY_HOME/webapps wget http://nexus.sonatype.org/downloads/nexus-webapp-1.4.0.war cd .. ./bin/jetty.sh restart

Point browser to http://localhost:8080/nexus-webapp-1.4.0/
Login as admin/admin123

Click on the link “repositories” on the left and choose the “Release”
repository. There is a local path configured as attribute “Default
Local Storage Location”.

If you already have a local repositories (in ~/.m2/repository), you
should copy all artifacts to that folder. Like:

cp ~/.m2/repository/* ~/sonatype-work/nexus/storage/releases/

Then the artifacts will become available to the URL of the Release
repository. Now adding that repository in your pom.xml will make Maven
use those artifacts during build.

That’s all.

[1] http://www.sonatype.com/books/mhandbook/reference/

Posted via email from The Lazy Dev

Multi brand (skinned) application with Maven 2 and Wicket.

In this two part article, I will explain how to configure a web application built with Maven to support “branding”, or skinning. That is, support different distribution skinned with particular images, logo, background, text. In the end we just want to keep separated the static contents and choose the right set when we package our application so that the result is a war with just the content for a single company. I call this a branded distribution using brand as a similar work for skinning. Brand looks more enterprise and general than skinning, anyway :)

In the second part of the article I will also cover the Wicket side of the story. The Maven side works by himself, anyway.

read the complete article

PostgreSql tamed

This morning I had to do one of those thing I procrastinated for years: really put my head in administer a PostgreSql server to make some very very basic stuff. I mean, via console, without using PgAdmin. And I also managed to write down a memo about what is really needed to be done.

These are very, very, basically stuff. But I always forgot them and I have never learned to perform this task fine.
My target is, from a scratch installation of Postgres, to create a database and to access it from an application of mine. Let’s start.

sudo -u postgres psql postgres

we log into psql console. Eventually we can change the USER “postgres” password with

\password postgres

Now, let’s try a couple of useful command that serious programmer knows “as gods gift”, while I had to search on google this morning.

\du lists existing roles

\l lists existing databases

Now, proceede with creation of a user. Be aware that the psql console has autocomplete, with TAB as usually.

CREATE USER della CREATEDB;

ALTER USER della WITH PASSWORD ’secret’;

now we have the user *AND* the role. These are different concepts in postgres. As far as I have understood, ROLE does not give you USER privileges, such as login. So one can ask, why do ever need a ROLE? Couse you can couple postgres roles with linux users. But is too much complicated stuff so we created a postgres USER that just works. Now, go on with database:

CREATE DATABASE newsautom OWNER della;
GRANT ALL PRIVILEGES ON DATABASE newsautom to della;

That’s all. Now we can acccess database “newsautom” with user “della” and password “secret” from our aplpication.

As final bonus, here is the best simple guide I found around:
http://www.cyberciti.biz/faq/howto-add-postgresql-user-account/

Posted via email from The Lazy Dev

Publishing projects reports: work in progress

In these days I am working to make publicly available all the relevant
informations about my projects so that people interested in it or in
my developments work can have a look. Right now there is only Phaedra:
http://dev.ildella.net/projects/phaedra/

This is an example and contains information about my “framework” for
building web applications that I called Phaedra. Phaedra is modular
and in the next days I will extract two more modules from
phaedra-webapp: phaedra-wicket and phaedra-persistence that will
remain the container with a skeleton for a Web applications that uses
all other modules.

But the generic information, what I want is to publish the report for
this project, to show code analysis, test coverage and so on. All this
metrics are calculated using Sonar that uses all the other open source
report tools. I would like to make Sonar server public but it uses a
lot of resources so for now I have it on my internal server. Actually,
PDF Sonar report are created, I will try to automatically publish them
all.

How everything works? I have a machine here in my office (ok, house),
that acts as CI+Sonar server (as well as mediacenter). All my projects
are built by Hudson and Sonar report are generated and installed on
local Sonar server. Then the generated Maven site with all single
reporting tools reports is published on static site.

I will prepare the main project portfolio page (by hand) on
http://ildella.net soon.

Posted via email from The Lazy Dev

UNSTOPPABLE

three new personal domain registered: DONE
virtual server on Slicehost: DONE
learn how to configure DNS and do it: DONE
total control on slicehost virtual server: GOT IT!
resume’ online: DONE
updated Ohloh profile and open source activities: DONE
blog updated to latest wordpress and redesigned to have a presentation
page: DONE
presentation page: NOT DONE
server http + mysql + php5 + wordpress on the new servr: DONE, JUST FOR FUN
configure a subversion server: BEGUN, STILL NOT WORKING!
Sonar local server for code analysis: DONE

By the way, in the free time.

To come: hudson and sonar publicly available for my projects!

Posted via email from The Lazy Dev

Half october updates.

Bullet point that is late and I have a lot of work to do.

1. I have a google wave account. Yesterday evening I tried to embed wave in a webapp but I found out I need a sandbox developer account I just requested. Waiting. Wave looks very fine but it is still empty.
2. I almost complete my open source stack for building web applications at Ohloh.
3. I published an article on WicketByExample about tinyMce and Wicket. A new one is already written and will talk about some other subtle problems emerged during development.
4. In last month of development I migrated to hibernate 3.4 and started using JPA and Entity Manager. Next steps is OSGI.
5. I am fascinated about trying out Sonar (code quality), Emma (test coverage) and maybe Archiva (artifact repository manager). Maybe I will have time next month.
6. I need business cards. I think I will use Moo.
7. I swear, there was a seven, but time is over.

Posted via email from The Lazy Dev

How to create maven archetype and a Catalog for project automatic generation

As many that are using maven 2 since years, I have many mavenized projects and the most of them have similar structure: are web projects, uses jetty and other plugins, many shares a lot of dependencies. So I decided to create an archetype to quickly generate new projects. I also wanted to use the mvn archetype generate command, so I prepared a archetypes catalog in my repository to allow me to use my personal archetypes with automatic generation.

As a start, I took an existing mvn archetype source code. Yes, maybe there are a good tutorial but what is better than an existing simple projects to modify? I am the lazy dev after all. I choose wicketrad-archetype, for the only reason I already had the code on my computer.

There are just two things to do:

  1. Change group and artifact id in the archetype pom (the one in the root folder) with what you like i called mines net.ildella.archetypes.base and net.ildella.archetypes.pheadra.
  2. Modify the pom.xml in src/main/resources/archetype-resources. This will be the one that will be used as basis for generated projects. Put in there whatever you like: plugins with configurations, dependencies, some comment as tip or reminder should also be useful.

Then a simple "mvn install" will install archetype artifact in local repository.

Let's now go for the Catalogue: create a file called archetype-catalog.xml with a content like this one:

<pre>
<?xml version="1.0" encoding="UTF-8"?>
<archetype-catalog>
   <archetypes>
<archetype>
           <groupId>net.ildella.archetypes</groupId>
           <artifactId>base</artifactId>
           <version>1.0</version>
           <repository>http://www.mvnsearch.org/maven2</repository>
           <description>Basic maven projects with useful stuff configured</description>
       </archetype>
<archetype>
           <groupId>net.ildella.archetypes</groupId>
           <artifactId>phaedra</artifactId>
           <version>1.0</version>
           <repository>http://www.mvnsearch.org/maven2</repository>
           <description>Basic + pheadra dependencies and stuff</description>
       </archetype>
   </archetypes>
</archetype-catalog>
</pre>

and put it in your ~/.m2/repository folder, or wherever you keep your repository.
That's all. Now we can do:

<pre>
mvn archetype:generate -DarchetypeCatalog=file:///home/ildella/.m2/repository/
</pre>

to get the following result:

we choose a number and we got our skeleton project.

If like me you started from wicketrad-archetype, have a look at file src/main/resources/META-INF/maven/archetype.xml to see how to include resources to your skeleton project, for example to add some demonstration classes.

Posted via email from The Lazy Dev

ubuntu 9.10

sudo apt-get install flashplugin-nonfree msttcorefonts ttf-dejavu
ttf-xfree86-nonfree

ridere quando gli utenti linux si fanno problemi tipo: ” eh non voglio
installare quest’altra cosa che il computer si appesantisce”

Posted via email from il blog del della

Resource access in web sites: authorization

In the Java world when you talk about topic like security,
authentication, authorisation… everyone think about libraries like
Spring Security (ex ACEGI) and now someone at the new incubated Apache
Ki (formerly jSecurity). Many web framework like wicket that I use
have a support for the auth stuff in external modules.

 I do not feel good with this products because, like most java
libraries, are for very complicated environment and typically emerge
from years of experience building sophisticated web applications. They
are very generic in some aspects, especially about authorisation. They
offer a great support for authentication and for integration with
external sources. But on the authorisation side, I still miss
something.

 None of them tell me in any way what are the right way to use them.

 Now my experience is limited compare to whoever ever worked for ACEGI,
jSecurity or whatever. Regardless, I know some key aspect and I want
to simplify some kind of development.

 What I need typically is to
. authenticate user, one time
. authorise user: perform check about user being authorised to
read/write on some resource, every time is needed

 authenticate user is two step:
. verify user credentials and if they match,
. give the user an authentication with all its “permissions” associated

 authorise user is something like this:
. every time a session try to access a resource, we ask for the
session user and verify that the user has permission to read/write
that specific resource.

 I am focusing on resource access, on authorisation. What is a
resource? Till today I just have what I now call *system resources”: a
link, a button, a portion of text. Everything that is already there at
the beginning of time. Then I have the “users resources”‘: everything
that is added to the system by a user. This second category is very
important these days with all this social-user-generated stuff.

 What I also noticed is that a typical method to implements
authorisation based on user-permission, is good both for system and
for users resources. What I need is to clarify the difference at the
application level.

 Given that this kind of distinction is typical in many application, I
can move to a share library that uses a low-level authorisation system
and give me something more related to a real domain to use. My bet is
that with this new level we gain clarity without losing flexibility
and gain a lot of productivity.

 I am working on an implementation that will grant me to have
users-level permissions on users-resources that is backed by the same
implementation I use for system resources. If I will get some
interesting results, I will publish something open source.

Posted via email from The Lazy Dev

The though developer dilemma: to customise or not to customise?

I am a software developer and I assume to be a real one and though and serious and pure. I never liked to deal with big all-in-one software packages.
That is not development, is customisation.

But.

Today I was called by a potential customer that needs a small e-commerce for his small business. First idea has been to send him to one site like Shopify. Then I say: calm down, maybe it needs something custom, let's get an appointment, we will see. While talking, my wicked head was thinking about how to develop a e-shop for a reasonable price with the tecnhology I already know. This is madness.

In fact after a few minutes I realised that no mental healthy developer would have developed a e-shop from scratch. By the way, if not for a big amount of money and some certain kind of customer (very big or retarded). Shopping kart, archive, customers, shipping, payment… years!!!

So what: out there there are OFBiz and KonaKart, that I can use for. And maybe also others, these are the two most famouse built in Java. Is this customisation?
For the same reason, I have been hit in the head bt the very recent news that Friendfeed engine has been open sourced by Facebook. This is HUGE guys. I have a couple of web applications I would love to realize that will fit perfectly on such an engine and to develop such a thing for me would require… ages! So with this technology I can focus on the business. I just need to learn python. Well, sooner or later…

So what? I am a developer but I want to be a entrepreneur, also. As a tech entrpreneur I need to deal with this kind of technology, that would allow me the faster time to market and the best technology available as well.

So, my soul is save. The developer will continue to be the serious one, that will never do dumb customisation.
Sometime, I will wear the (technological) entrepreneur hat and will start playing with those kind of stuff.

Phew.

Posted via email from The Lazy Dev

Next Page »