Using links (was RE: Question about shutdown of Metro controller)
Stephen McConnell
mcconnell at dpml.net
Sat Jan 21 16:50:16 EST 2006
> -----Original Message-----
> From: Carel Paradis
> public class WebService extends HttpServlet {
> private static final long serialVersionUID = 0L;
>
> private Component _component = null;
>
> public WebService() {
> super();
> }
>
> public void init() throws ServletException {
> super.init();
>
> try {
> final Controller controller = Controller.STANDARD;
> final URI uri = new
> URI("artifact:part:carelparadis/sunrise/test/test-component#SN
> APSHOT");
Although not the subject of this email I thought I'd just mention here the
usage of links. In the above line you have a direct reference to a
versioned artifact which as a general rule is not great because if you do a
versioned build then either one of the following two things will happen:
- if the SNAPSHOT version is in the cache it will be picked up by the
implementation silently
- or if no SNAPSHOT in the cashe your testcase will fail due to a missing
resource exception
The solution to this is to replace this:
artifact:part:carelparadis/sunrise/test/test-component#SNAPSHOT
with:
link:part:carelparadis/sunrise/test/test-component
To create a link artifact you will need to add the 'alias="true"' attribute
to the part type declaration in you project definition. For example:
<types>
<type id="jar"/>
<type id="part" alias="true">
</types>
Once the above is in place the runtime will dereference the link to the
versioned artifact.
Cheers, Steve.
More information about the dev-dpml
mailing list