buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/taskdefs/JoinTask.java
author wbernard
Fri, 13 Aug 2010 14:59:05 +0300
changeset 628 7c4a911dc066
parent 587 85df38eb4012
permissions -rw-r--r--
helium_11.0.0-e00f171ca185
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     1
/*
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     2
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     3
* All rights reserved.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     4
* This component and the accompanying materials are made available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     6
* which accompanies this distribution, and is available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     8
*
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     9
* Initial Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    11
*
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    12
* Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    13
*
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    14
* Description:  
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    15
*
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    16
*/
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    17
package com.nokia.helium.sysdef.ant.taskdefs;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    18
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    19
import java.io.File;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    20
import java.util.Hashtable;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    21
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    22
/**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    23
 * <p>This task allows to do the join operation on system definition file v3.0.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    24
 * Join operation consist in combining a distributed system definition file into
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
 * a stand-alone version.</p>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    26
 * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    27
 * <p>The following example shows how you can join the X:\layer.sysdef.xml under
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    28
 * X:\joined_layer.sysdef.xml.</p>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    29
 * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    30
 * E.g:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
 * <pre>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    32
 *   &lt;hlm:joinSysdef epocroot=&quot;X:\&quot; srcfile=&quot;X:\layer.sysdef.xml&quot; 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    33
 *                      destfile=&quot;X:\joined_layer.sysdef.xml&quot; /&gt;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    34
 * </pre>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    35
 *
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    36
 * For more information about system definition file v3.0 please check 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    37
 * <a href="http://developer.symbian.org/wiki/index.php/System_Definition">http://developer.symbian.org/wiki/index.php/System_Definition</a>.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    38
 *
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    39
 * <br>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    40
 * This task relies on externals tools. Their location can be configured the following ways:
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    41
 *  <li>by configuring the sysdef.tools.home property, fails if the location is incorrect.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    42
 *  <li>The parent folder of the joinsysdef tool from the PATH, fallback on SDK location.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    43
 *  <li>Default SDK location.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    44
 *
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    45
 * @ant.task name="joinSysdef" category="Sysdef"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    46
 */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    47
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    48
public class JoinTask extends AbstractSydefTask {
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    49
    private static final String XSLT = "joinsysdef.xsl"; 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    50
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
    /**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    52
     * {@inheritDoc}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    54
    public void execute() {
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    55
        // This task is configure to always fail on warnings,
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    56
        // because it doesn't fails in case of missing link. 
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    57
        this.setFailOnWarning(true);
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    58
        check();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    59
        log("Joining " + this.getSrcFile()); 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    60
        log("Creating " + this.getDestFile());
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    61
        transform(new Hashtable<String, String>());
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    62
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    63
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    64
    /**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    65
     * {@inheritDoc}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    66
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    67
    @Override
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    68
    protected File getXsl() {
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    69
        return new File(SysdefUtils.getSysdefHome(getProject(), this.getEpocroot()), XSLT);
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    70
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    71
}