buildframework/helium/sf/java/sbs/src/com/nokia/helium/sbs/ant/types/SBSInput.java
author wbernard
Fri, 13 Aug 2010 14:59:05 +0300
changeset 628 7c4a911dc066
parent 588 c7c26511138f
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
/*
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
     2
 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
     3
 * All rights reserved.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
     4
 * This component and the accompanying materials are made available
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
     6
 * which accompanies this distribution, and is available
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
     8
 *
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
     9
 * Initial Contributors:
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    10
 * Nokia Corporation - initial contribution.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    11
 *
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    12
 * Contributors:
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    13
 *
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    14
 * Description: 
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    15
 *
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    16
 */
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    17
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    18
package com.nokia.helium.sbs.ant.types;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    19
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    20
import java.util.Collection;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    21
import java.util.Vector;
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    22
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    23
import org.apache.tools.ant.BuildException;
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    24
import org.apache.tools.ant.types.DataType;
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
import org.apache.tools.ant.types.Reference;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    26
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    27
import com.nokia.helium.core.ant.MappedVariable;
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    28
import com.nokia.helium.core.ant.VariableMap;
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    29
import com.nokia.helium.core.ant.types.VariableSet;
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    30
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
/**
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    32
 * Helper class to store the variable set (list of variables with name / value pair)
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    33
 * 
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    34
 * <hlm:sbsinput id="export-sbs-ec"> <sbsoptions refid="exportSBS"
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    35
 * /> <sbsmakeoptions refid="exportSBSEC" /> </hlm:sbsinput>
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    36
 * 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    37
 * @ant.type name="sbsinput" category="SBS"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    38
 */
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    39
public class SBSInput extends DataType implements VariableMap {
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    40
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    41
    private Vector<VariableSet> sbsOptions = new Vector<VariableSet>();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    42
    private Vector<SBSMakeOptions> sbsMakeOptions = new Vector<SBSMakeOptions>();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    43
    private Vector<SBSInput> sbsInputList = new Vector<SBSInput>();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    44
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    45
    /**
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    46
     * Creates an empty variable element and adds it to the variables list
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    47
     * 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    48
     * @return empty Variable pair
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    49
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    50
    public VariableSet createSBSOptions() {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
        SBSInput sbsInput = new SBSInput();
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    52
        VariableSet varSet = new VariableSet();
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
        sbsInput.addSBSOptions(varSet);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    54
        sbsInputList.add(sbsInput);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    55
        return varSet;
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
    /**
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    59
     * Adds sbs options to variableset. Called by ant whenever the varSet is added to current sbs
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    60
     * options.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    61
     * 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    62
     * @param varSet, variable set to be added to current sbs options.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    63
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    64
    public void addSBSOptions(VariableSet varSet) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    65
        sbsOptions.add(varSet);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    66
    }
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    67
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    68
    /**
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    69
     * Creates an empty sbs make options and add it sbs make options list
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    70
     * 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    71
     * @return empty Variable pair
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    72
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    73
    public VariableSet createSBSMakeOptions() {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    74
        SBSInput sbsInput = new SBSInput();
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    75
        SBSMakeOptions varSet = new SBSMakeOptions();
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    76
        sbsInput.addSBSMakeOptions(varSet);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    77
        sbsInputList.add(sbsInput);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    78
        return varSet;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    79
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    80
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    81
    /**
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    82
     * Adds sbs make options to variableset. Called by ant whenever the make option is added to
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    83
     * current sbs options.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    84
     * 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    85
     * @param varSet, variable set to be added to current sbs options.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    86
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    87
    public void addSBSMakeOptions(SBSMakeOptions varSet) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    88
        sbsMakeOptions.add(varSet);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    89
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    90
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    91
    /**
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    92
     * Creates a new sbsinput type for the current, and the created sbs input is only containing
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    93
     * refid of sbs options / sbs makeoptions.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    94
     * 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    95
     * @return empty sbsinput type.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    96
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    97
    public SBSInput createSBSInput() {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    98
        SBSInput sbsInput = new SBSInput();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    99
        sbsInputList.add(sbsInput);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   100
        return sbsInput;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   101
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   102
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   103
    /**
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   104
     * Helper function to provide the sbs options associated with this sbsinput.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   105
     * 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   106
     * @return sbs options associated with this sbs input.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   107
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   108
    public Vector<VariableSet> getSBSOptions() {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   109
        return sbsOptions;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   110
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   111
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   112
    /**
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   113
     * Helper function to provide the sbs make options associated with this sbsinput.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   114
     * 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   115
     * @return sbs make options associated with this sbs input.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   116
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   117
    public Vector<SBSMakeOptions> getSBSMakeOptions() {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   118
        return sbsMakeOptions;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   119
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   120
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   121
    /**
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   122
     * Internal function to validate the sbsinput and throw exception if the input is not valid.
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   123
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   124
    private void validateInput() {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   125
        if (getRefid() != null && (!sbsMakeOptions.isEmpty() || !sbsOptions.isEmpty())) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   126
            throw new BuildException("SBSInput with refid should not have sbsoptions / sbsmakeoptions");
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   127
        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   128
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   129
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   130
    /**
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   131
     * Internal function to recursively gothrough the sbs options refered by this sbsinput and
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   132
     * provides the complete list of variables associated with this input.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   133
     * 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   134
     * @return collection of variableset associatied with this sbsinput.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   135
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   136
    private Vector<VariableSet> getSBSOptions(SBSInput sbsInput) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   137
        Vector<VariableSet> fullList = null;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   138
        sbsInput.validateInput();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   139
        Reference refId = sbsInput.getRefid();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   140
        Object sbsInputObject = null;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   141
        if (refId != null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   142
            try {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   143
                sbsInputObject = refId.getReferencedObject();
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   144
            }
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   145
            catch (BuildException ex) {
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   146
                // log.info("Reference id of sbsinput list is not valid");
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   147
                throw new BuildException("Reference id (" + refId.getRefId()
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   148
                    + ") of sbsinput list is not valid");
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   149
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   150
            if (sbsInputObject != null && sbsInputObject instanceof SBSInput) {
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   151
                VariableSet options = ((SBSInput) sbsInputObject).getFullSBSOptions();
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   152
                if (options != null) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   153
                    if (fullList == null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   154
                        fullList = new Vector<VariableSet>();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   155
                    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   156
                    fullList.add(options);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   157
                }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   158
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   159
        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   160
        Vector<VariableSet> optionsList = sbsInput.getSBSOptions();
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   161
        if (optionsList != null) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   162
            if (fullList == null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   163
                fullList = new Vector<VariableSet>();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   164
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   165
            fullList.addAll(optionsList);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   166
        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   167
        return fullList;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   168
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   169
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   170
    /**
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   171
     * Internal function to recursively gothrough the sbs make options refered by this sbsinput and
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   172
     * provides the complete list of sbs make options associated with this input.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   173
     * 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   174
     * @return collection of sbs make options associatied with this sbsinput.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   175
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   176
    private Vector<SBSMakeOptions> getSBSMakeOptions(SBSInput sbsInput) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   177
        Vector<SBSMakeOptions> sbsMakeOptionsList = null;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   178
        Reference refId = sbsInput.getRefid();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   179
        Object sbsInputObject = null;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   180
        if (refId != null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   181
            try {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   182
                sbsInputObject = refId.getReferencedObject();
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   183
            }
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   184
            catch (BuildException ex) {
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   185
                throw new BuildException("Reference id (" + refId.getRefId()
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   186
                    + ") of sbsinput list is not valid");
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   187
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   188
            if (sbsInputObject != null && sbsInputObject instanceof SBSInput) {
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   189
                SBSMakeOptions options = ((SBSInput) sbsInputObject).getFullSBSMakeOptions();
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   190
                if (options != null) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   191
                    if (sbsMakeOptionsList == null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   192
                        sbsMakeOptionsList = new Vector<SBSMakeOptions>();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   193
                    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   194
                    sbsMakeOptionsList.add(options);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   195
                }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   196
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   197
        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   198
        Vector<SBSMakeOptions> options = sbsInput.getSBSMakeOptions();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   199
        if (options != null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   200
            if (sbsMakeOptionsList == null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   201
                sbsMakeOptionsList = new Vector<SBSMakeOptions>();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   202
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   203
            sbsMakeOptionsList.addAll(options);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   204
        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   205
        return sbsMakeOptionsList;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   206
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   207
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   208
    /**
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   209
     * Internal function to recursively gothrough the sbs make options refered by this sbsinput and
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   210
     * provides the complete list of sbs make options associated with this input.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   211
     * 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   212
     * @return collection of sbs make options associatied with this sbsinput.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   213
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   214
    public VariableSet getFullSBSOptions() {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   215
        Vector<VariableSet> fullList = null;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   216
        VariableSet resultSet = null;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   217
        Vector<VariableSet> currentOptions = getSBSOptions(this);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   218
        if (currentOptions != null && !currentOptions.isEmpty()) {
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   219
            if (fullList == null) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   220
                fullList = new Vector<VariableSet>();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   221
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   222
            fullList.addAll(currentOptions);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   223
        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   224
        for (SBSInput sbsInput : sbsInputList) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   225
            Vector<VariableSet> options = getSBSOptions(sbsInput);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   226
            if (options != null && !options.isEmpty()) {
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   227
                if (fullList == null) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   228
                    fullList = new Vector<VariableSet>();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   229
                }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   230
                fullList.addAll(options);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   231
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   232
        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   233
        if (fullList != null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   234
            for (VariableSet varSet : fullList) {
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   235
                for (MappedVariable var : varSet.getVariables()) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   236
                    if (resultSet == null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   237
                        resultSet = new VariableSet();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   238
                    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   239
                    resultSet.add(var);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   240
                }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   241
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   242
        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   243
        return resultSet;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   244
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   245
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   246
    /**
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   247
     * Internal function to recursively gothrough the sbs make options refered by this sbsinput and
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   248
     * provides the complete list of sbs make options associated with this input.
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   249
     * 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   250
     * @return collection of sbs make options associatied with this sbsinput.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   251
     */
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   252
    public SBSMakeOptions getFullSBSMakeOptions() {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   253
        Vector<SBSMakeOptions> sbsMakeOptionsList = null;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   254
        SBSMakeOptions resultSet = null;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   255
        Vector<SBSMakeOptions> currentOptions = getSBSMakeOptions(this);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   256
        if (currentOptions != null && !currentOptions.isEmpty()) {
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   257
            if (sbsMakeOptionsList == null) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   258
                sbsMakeOptionsList = new Vector<SBSMakeOptions>();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   259
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   260
            sbsMakeOptionsList.addAll(currentOptions);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   261
        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   262
        for (SBSInput sbsInput : sbsInputList) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   263
            Vector<SBSMakeOptions> options = getSBSMakeOptions(sbsInput);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   264
            if (options != null && !options.isEmpty()) {
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   265
                if (sbsMakeOptionsList == null) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   266
                    sbsMakeOptionsList = new Vector<SBSMakeOptions>();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   267
                }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   268
                sbsMakeOptionsList.addAll(options);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   269
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   270
        }
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   271
        if (sbsMakeOptionsList != null) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   272
            String engine = null;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   273
            String ppThreads = null;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   274
            for (SBSMakeOptions varSet : sbsMakeOptionsList) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   275
                String currentEngine = varSet.getEngine();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   276
                String currentThread = varSet.getPPThreads();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   277
                if (currentEngine != null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   278
                    if (engine == null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   279
                        engine = currentEngine;
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   280
                        if (resultSet == null) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   281
                            resultSet = new SBSMakeOptions();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   282
                        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   283
                        resultSet.setEngine(currentEngine);
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   284
                    }
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   285
                    else {
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   286
                        if (!engine.equals(currentEngine)) {
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   287
                            throw new BuildException("inheriting engine types mismatch: " + engine
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   288
                                + " != " + currentEngine);
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   289
                        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   290
                    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   291
                }
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   292
                if (resultSet == null) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   293
                    resultSet = new SBSMakeOptions();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   294
                }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   295
                if (ppThreads == null && currentThread != null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   296
                    ppThreads = currentThread;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   297
                    resultSet.setPPThreads(ppThreads);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   298
                }
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   299
                for (MappedVariable var : varSet.getVariables()) {
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   300
                    resultSet.add(var);
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   301
                }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   302
            }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   303
        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   304
        return resultSet;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   305
    }
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   306
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   307
    /**
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   308
     * Helper function to return the collection of variabes associated with this
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   309
     * 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   310
     * @return collection of sbs options associatied with this sbsinput.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   311
     */
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   312
    public Collection<MappedVariable> getVariables() {
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   313
        Collection<MappedVariable> varList = null;
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   314
        VariableSet options = getFullSBSOptions();
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   315
        if (options != null) {
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   316
            varList = options.getVariables();
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   317
        }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   318
        return varList;
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   319
    }
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   320
}