Search in sources :

Example 26 with FunctionDefinition

use of com.dexels.navajo.expression.api.FunctionDefinition in project navajo by Dexels.

the class FunctionListCommand method _functions.

public void _functions(CommandInterpreter ci) {
    String serviceFilter = null;
    String filter = ci.nextArgument();
    if (filter != null) {
        serviceFilter = "(functionName=" + filter + ")";
    }
    ci.println("filter: " + filter);
    try {
        Collection<ServiceReference<FunctionInterface>> result = bundleContext.getServiceReferences(FunctionInterface.class, serviceFilter);
        for (ServiceReference<FunctionInterface> serviceReference : result) {
            String functionName = (String) serviceReference.getProperty("functionName");
            FunctionDefinition fd = (FunctionDefinition) serviceReference.getProperty("functionDefinition");
            ci.println("" + functionName);
            ci.println("\t" + fd.getDescription());
        // }
        }
    } catch (InvalidSyntaxException e) {
        logger.error("Error: ", e);
    }
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) FunctionDefinition(com.dexels.navajo.expression.api.FunctionDefinition) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) ServiceReference(org.osgi.framework.ServiceReference)

Aggregations

FunctionDefinition (com.dexels.navajo.expression.api.FunctionDefinition)26 FunctionInterface (com.dexels.navajo.expression.api.FunctionInterface)20 Test (org.junit.Test)13 GiveLongTestFunction (com.dexels.navajo.expression.compiled.GiveLongTestFunction)10 Operand (com.dexels.navajo.document.Operand)8 ArrayList (java.util.ArrayList)7 StringReader (java.io.StringReader)5 AddTestFunction (com.dexels.navajo.expression.compiled.AddTestFunction)4 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)4 ServiceReference (org.osgi.framework.ServiceReference)4 XMLElement (com.dexels.navajo.document.nanoimpl.XMLElement)3 ContextExpression (com.dexels.navajo.expression.api.ContextExpression)3 Before (org.junit.Before)2 BundleContext (org.osgi.framework.BundleContext)2 CaseSensitiveXMLElement (com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement)1 TMLExpressionException (com.dexels.navajo.expression.api.TMLExpressionException)1 GiveMoneyTestFunction (com.dexels.navajo.expression.compiled.GiveMoneyTestFunction)1 GivePercentageTestFunction (com.dexels.navajo.expression.compiled.GivePercentageTestFunction)1 ParameterNamesFunction (com.dexels.navajo.expression.compiled.ParameterNamesFunction)1 FunctionFactoryInterface (com.dexels.navajo.functions.util.FunctionFactoryInterface)1