Search in sources :

Example 1 with JclConfiguration

use of com.ibm.j9tools.om.JclConfiguration in project openj9 by eclipse.

the class BuildSpecParser method endElement.

/**
 * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
 */
@Override
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) {
    if (qName.equalsIgnoreCase("name")) {
        // $NON-NLS-1$
        _buildSpec.setName(_parsedValue);
    } else if (qName.equalsIgnoreCase("asmBuilderName")) {
        // $NON-NLS-1$
        AsmBuilder asmBuilder = new AsmBuilder(_parsedValue);
        asmBuilder.setLocation(_documentLocatorFile, _documentLocator);
        _buildSpec.setAsmBuilder(asmBuilder);
    } else if (qName.equalsIgnoreCase("cpuArchitecture")) {
        // $NON-NLS-1$
        _buildSpec.setCpuArchitecture(_parsedValue);
    } else if (qName.equalsIgnoreCase("os")) {
        // $NON-NLS-1$
        _buildSpec.setOs(_parsedValue);
    } else if (qName.equalsIgnoreCase("defaultJCL")) {
        // $NON-NLS-1$
        JclConfiguration jclConfiguration = new JclConfiguration(_parsedValue);
        jclConfiguration.setLocation(_documentLocatorFile, _documentLocator);
        _buildSpec.setDefaultJCL(jclConfiguration);
    } else if (qName.equalsIgnoreCase("defaultSizes")) {
        // $NON-NLS-1$
        DefaultSizes defaultSizes = new DefaultSizes(_parsedValue);
        defaultSizes.setLocation(_documentLocatorFile, _documentLocator);
        _buildSpec.setDefaultSizes(defaultSizes);
    } else if (qName.equalsIgnoreCase("priority")) {
        // $NON-NLS-1$
        try {
            _buildSpec.setPriority(Integer.parseInt(_parsedValue));
        } catch (NumberFormatException e) {
            // $NON-NLS-1$
            error(new SAXParseException("Invalid priority value, not a valid integer.", _documentLocator));
        }
    } else if (qName.equalsIgnoreCase("owner")) {
        // $NON-NLS-1$
        /* Parsed a single owner, add it to the list of Owners */
        Owner owner = new Owner(_parsedValue);
        owner.setLocation(_documentLocatorFile, _documentLocator);
        _buildSpec.addOwner(owner);
    } else if (qName.equalsIgnoreCase("owners")) {
        // $NON-NLS-1$
        /* Parsed all owners, add it to the BuildSpec */
        _owners.add(new Owner(_parsedValue));
    } else /* The <flags> element is being closed. Add all parsed flags to the buildSpec */
    if (qName.equalsIgnoreCase("flags")) {
        // $NON-NLS-1$
        for (Flag f : _flags) {
            _buildSpec.addFlag(f);
        }
        // flags set to a default value of FALSE
        for (FlagDefinition flagDefinition : flagDefinitions.getFlagDefinitions().values()) {
            if (!_buildSpec.hasFlag(flagDefinition.getId())) {
                _buildSpec.addFlag(new Flag(flagDefinition));
            }
        }
    } else /* The <features> element is being closed. Add all parsed features to the buildSpec */
    if (qName.equalsIgnoreCase("features")) {
        // $NON-NLS-1$
        for (Feature f : _features) {
            /* Save the feature id, it is not our responsibility to load the actual feature here */
            _buildSpec.addFeature(f);
        }
    } else /* The <sources> element is being closed. Add all parsed sources to the buildSpec */
    if (qName.equalsIgnoreCase("source")) {
        // $NON-NLS-1$
        for (Source s : _sources) {
            _buildSpec.addSource(s);
        }
    } else /* The <properties> element is being closed. Add all parsed properties to the buildSpec */
    if (qName.equalsIgnoreCase("properties")) {
        // $NON-NLS-1$
        for (Property p : _properties) {
            _buildSpec.addProperty(p);
        }
    }
}
Also used : AsmBuilder(com.ibm.j9tools.om.AsmBuilder) Owner(com.ibm.j9tools.om.Owner) JclConfiguration(com.ibm.j9tools.om.JclConfiguration) FlagDefinition(com.ibm.j9tools.om.FlagDefinition) SAXParseException(org.xml.sax.SAXParseException) DefaultSizes(com.ibm.j9tools.om.DefaultSizes) Flag(com.ibm.j9tools.om.Flag) Feature(com.ibm.j9tools.om.Feature) Property(com.ibm.j9tools.om.Property) Source(com.ibm.j9tools.om.Source) InputSource(org.xml.sax.InputSource)

Aggregations

AsmBuilder (com.ibm.j9tools.om.AsmBuilder)1 DefaultSizes (com.ibm.j9tools.om.DefaultSizes)1 Feature (com.ibm.j9tools.om.Feature)1 Flag (com.ibm.j9tools.om.Flag)1 FlagDefinition (com.ibm.j9tools.om.FlagDefinition)1 JclConfiguration (com.ibm.j9tools.om.JclConfiguration)1 Owner (com.ibm.j9tools.om.Owner)1 Property (com.ibm.j9tools.om.Property)1 Source (com.ibm.j9tools.om.Source)1 InputSource (org.xml.sax.InputSource)1 SAXParseException (org.xml.sax.SAXParseException)1