Search in sources :

Example 1 with UMAException

use of com.ibm.uma.UMAException in project openj9 by eclipse.

the class PredicateList method evalutePredicate.

boolean evalutePredicate(String predicate) throws UMAException {
    String[] preds = predicate.split("\\s");
    boolean result = true;
    boolean predicateFound = false;
    boolean andOp = false;
    boolean orOp = false;
    boolean xorOp = false;
    boolean notOp = false;
    for (String pred : preds) {
        if (pred.equalsIgnoreCase("and")) {
            if (orOp || xorOp || notOp || !predicateFound) {
                throw new UMAException("Error: badly formed predicate [" + predicate + "] in " + containingFile);
            }
            andOp = true;
            continue;
        } else if (pred.equalsIgnoreCase("or")) {
            if (andOp || xorOp || notOp || !predicateFound) {
                throw new UMAException("Error: badly formed predicate [" + predicate + "] in " + containingFile);
            }
            orOp = true;
            continue;
        } else if (pred.equalsIgnoreCase("xor")) {
            if (andOp || orOp || notOp || !predicateFound) {
                throw new UMAException("Error: badly formed predicate [" + predicate + "] in " + containingFile);
            }
            xorOp = true;
            continue;
        } else if (pred.equalsIgnoreCase("not")) {
            notOp = true;
            continue;
        } else {
            predicateFound = true;
        }
        if (andOp) {
            result = result && (notOp ? !evaluateSinglePredicate(pred) : evaluateSinglePredicate(pred));
        } else if (orOp) {
            result = result || (notOp ? !evaluateSinglePredicate(pred) : evaluateSinglePredicate(pred));
        } else if (xorOp) {
            result = result ^ (notOp ? !evaluateSinglePredicate(pred) : evaluateSinglePredicate(pred));
        } else {
            result = notOp ? !evaluateSinglePredicate(pred) : evaluateSinglePredicate(pred);
        }
        notOp = false;
        orOp = false;
        andOp = false;
        xorOp = false;
    }
    return result;
}
Also used : UMAException(com.ibm.uma.UMAException)

Example 2 with UMAException

use of com.ibm.uma.UMAException in project openj9 by eclipse.

the class PlatformWindows method writeTopLevelTargets.

@Override
public void writeTopLevelTargets(StringBuffer buffer) throws UMAException {
    super.writeTopLevelTargets(buffer);
    if (!configuration.isFlagSet("uma_windowsRebase")) {
        // No rebase in openj9 builds
        // ReBase.exe has been removed since Windows SDK 8. It could be replaced with "editbin /REBASE":
        // e.g.
        // editbin /REBASE:BASE=0x7FFFF750000,DOWN /DYNAMICBASE:NO /NOLOGO <list of *.ddl files>
        buffer.append("\n");
        buffer.append("export UMA_SINGLE_REBASE=1\n");
        buffer.append("\n\n");
    } else {
        try {
            // Add the rebase targets
            writeRebaseTargets(buffer);
            writeTweakedPhaseTargets(buffer);
        } catch (IOException e) {
            throw new UMAException(e);
        }
    }
}
Also used : IOException(java.io.IOException) UMAException(com.ibm.uma.UMAException)

Example 3 with UMAException

use of com.ibm.uma.UMAException in project openj9 by eclipse.

the class Spec method get.

public TemplateModel get(String arg0) throws TemplateModelException {
    if (arg0.equals("flags")) {
        return new Flags();
    }
    if (arg0.equals("tools")) {
        return new Tools();
    }
    if (arg0.equals("properties")) {
        return new Properties();
    }
    if (arg0.equals("artifacts")) {
        return new Artifacts(UMA.getUma().getArtifacts());
    }
    if (arg0.equals("type")) {
        return new Type();
    }
    if (arg0.equals("processor")) {
        return new Processor();
    }
    try {
        TemplateModel platformExtension = com.ibm.uma.UMA.getUma().getPlatform().getDataModelExtension("uma.spec", arg0);
        if (platformExtension != null)
            return platformExtension;
        TemplateModel configurationExtension = com.ibm.uma.UMA.getUma().getConfiguration().getDataModelExtension("uma.spec", arg0);
        if (configurationExtension != null)
            return configurationExtension;
    } catch (UMAException e) {
        throw new TemplateModelException(e);
    }
    return null;
}
Also used : TemplateModelException(freemarker.template.TemplateModelException) TemplateModel(freemarker.template.TemplateModel) UMAException(com.ibm.uma.UMAException)

Example 4 with UMAException

use of com.ibm.uma.UMAException in project openj9 by eclipse.

the class Flag method get.

public TemplateModel get(String arg0) throws TemplateModelException {
    if (arg0.equals("name")) {
        return new SimpleScalar(flag);
    }
    if (arg0.equals("enabled")) {
        return new BooleanModel(UMA.getUma().getConfiguration().isFlagSet(flag), new BeansWrapper());
    }
    try {
        TemplateModel platformExtension = com.ibm.uma.UMA.getUma().getPlatform().getDataModelExtension("uma.spec.flags." + flag, arg0);
        if (platformExtension != null)
            return platformExtension;
        TemplateModel configurationExtension = com.ibm.uma.UMA.getUma().getConfiguration().getDataModelExtension("uma.spec.flags." + flag, arg0);
        if (configurationExtension != null)
            return configurationExtension;
    } catch (UMAException e) {
        throw new TemplateModelException(e);
    }
    return null;
}
Also used : TemplateModelException(freemarker.template.TemplateModelException) BooleanModel(freemarker.ext.beans.BooleanModel) BeansWrapper(freemarker.ext.beans.BeansWrapper) TemplateModel(freemarker.template.TemplateModel) UMAException(com.ibm.uma.UMAException) SimpleScalar(freemarker.template.SimpleScalar)

Example 5 with UMAException

use of com.ibm.uma.UMAException in project openj9 by eclipse.

the class Artifact method get.

public TemplateModel get(String arg0) throws TemplateModelException {
    try {
        if (arg0.equals("name")) {
            return new ArtifactName(artifact);
        }
        if (arg0.equals("data")) {
            return new ArtifactData(artifact);
        }
        if (arg0.equals("targetNameWithRelease")) {
            return new SimpleScalar(UMA.getUma().getPlatform().getTargetNameWithRelease(artifact));
        }
        if (arg0.equals("exportNames")) {
            return new ExportNames(artifact);
        }
        if (arg0.equals("bundledArtifacts")) {
            return new Artifacts(artifact.getAllArtifactsInThisBundleInHashtable());
        }
        TemplateModel platformExtension = com.ibm.uma.UMA.getUma().getPlatform().getDataModelExtension("uma.spec.flags." + artifact.getTargetName(), arg0);
        if (platformExtension != null)
            return platformExtension;
        TemplateModel configurationExtension = com.ibm.uma.UMA.getUma().getConfiguration().getDataModelExtension("uma.spec.flags." + artifact.getTargetName(), arg0);
        if (configurationExtension != null)
            return configurationExtension;
        return null;
    } catch (UMAException e) {
        throw new TemplateModelException(e);
    }
}
Also used : TemplateModelException(freemarker.template.TemplateModelException) TemplateModel(freemarker.template.TemplateModel) UMAException(com.ibm.uma.UMAException) SimpleScalar(freemarker.template.SimpleScalar)

Aggregations

UMAException (com.ibm.uma.UMAException)13 IOException (java.io.IOException)6 File (java.io.File)5 TemplateModel (freemarker.template.TemplateModel)4 TemplateModelException (freemarker.template.TemplateModelException)4 SimpleScalar (freemarker.template.SimpleScalar)3 FileNotFoundException (java.io.FileNotFoundException)2 Vector (java.util.Vector)2 ConfigurationImpl (com.ibm.j9.uma.configuration.ConfigurationImpl)1 Flag (com.ibm.j9tools.om.Flag)1 UMA (com.ibm.uma.UMA)1 UMABadPhaseNameException (com.ibm.uma.UMABadPhaseNameException)1 Artifact (com.ibm.uma.om.Artifact)1 Command (com.ibm.uma.om.Command)1 Dependency (com.ibm.uma.om.Dependency)1 Export (com.ibm.uma.om.Export)1 Flag (com.ibm.uma.om.Flag)1 Include (com.ibm.uma.om.Include)1 Library (com.ibm.uma.om.Library)1 MakefileStub (com.ibm.uma.om.MakefileStub)1