/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.audit.Audit
 *  com.l7tech.policy.assertion.Assertion
 *  com.l7tech.policy.assertion.ext.VariableServices
 *  com.l7tech.policy.variable.PolicyVariableUtils
 *  com.l7tech.policy.variable.Syntax
 *  com.l7tech.policy.variable.VariableMetadata
 */
package com.l7tech.server.policy;

import com.l7tech.gateway.common.audit.Audit;
import com.l7tech.policy.assertion.Assertion;
import com.l7tech.policy.assertion.ext.VariableServices;
import com.l7tech.policy.variable.PolicyVariableUtils;
import com.l7tech.policy.variable.Syntax;
import com.l7tech.policy.variable.VariableMetadata;
import com.l7tech.server.policy.variable.ExpandVariables;
import java.util.Map;

public class VariableServicesImpl
implements VariableServices {
    private final Audit a;
    private final Assertion b;

    public VariableServicesImpl(Audit audit, Assertion assertion) {
        this.a = audit;
        this.b = assertion;
    }

    public String[] getReferencedVarNames(String string) {
        return Syntax.getReferencedNames((String)string);
    }

    public Object expandVariable(String string, Map map) {
        if (string == null || map == null) {
            return null;
        }
        return ExpandVariables.process(string, map, this.a);
    }

    public Map<String, VariableMetadata> getVariablesSetByPredecessors() {
        return PolicyVariableUtils.getVariablesSetByPredecessors((Assertion)this.b);
    }
}

