buildframework/helium/sf/java/sysdef/src/com/nokia/helium/sysdef/ant/taskdefs/DowngradeTask.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 downgrade of a system definition file v3.0 into v2.0.</p>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    24
 * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
 * <p>The following example shows how you can downgrade the X:\model.sysdef.xml as
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    26
 * X:\model_2_0_1.sysdef.xml.</p>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    27
 * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    28
 * E.g:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    29
 *   <pre>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    30
 *   &lt;hlm:downgradeSysdef epocroot=&quot;X:\&quot; srcfile=&quot;X:\model.sysdef.xml&quot; 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
 *                      destfile=&quot;X:\model_2_0_1.sysdef.xml&quot; /&gt;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    32
 *   </pre>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    33
 *
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    34
 *   For more information about system definition file v3.0 please check 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    35
 *   <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
    36
 *
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    37
 * <br>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    38
 * 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
    39
 *  <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
    40
 *  <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
    41
 *  <li>Default SDK location.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    42
 *
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    43
 *   @ant.task name="downgradeSysdef" category="Sysdef"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    44
 */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    45
public class DowngradeTask extends AbstractSydefTask {
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    46
    private static final String XSLT = "sysdefdowngrade.xsl"; 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    47
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    48
    /**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    49
     * {@inheritDoc}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    50
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
    public void execute() {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    52
        check();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
        log("Downgrading " + this.getSrcFile() + " to 2.0.1 schema.");
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    54
        log("Creating " + this.getDestFile());
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    55
        transform(new Hashtable<String, String>());
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    56
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    57
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    58
    /**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    59
     * {@inheritDoc}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    60
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    61
    @Override
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    62
    protected File getXsl() {
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    63
        return new File(SysdefUtils.getSysdefHome(getProject(), this.getEpocroot()), XSLT);
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    64
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    65
}