Search in sources :

Example 1 with FunctionFactoryInterface

use of com.dexels.navajo.functions.util.FunctionFactoryInterface in project navajo by Dexels.

the class AbstractCoreExtension method registerAllAdapters.

private void registerAllAdapters(ExtensionDefinition extensionDef) {
    FunctionFactoryInterface fi = FunctionFactoryFactory.getInstance();
    fi.init();
    fi.clearFunctionNames();
    fi.injectExtension(extensionDef);
    for (String adapterName : fi.getAdapterNames(extensionDef)) {
        fi.getAdapterConfig(extensionDef).get(adapterName);
        String adapterClass = fi.getAdapterClass(adapterName, extensionDef);
        Class<?> c = null;
        try {
            c = Class.forName(adapterClass, true, this.getClass().getClassLoader());
            Dictionary<String, Object> props = new Hashtable<>();
            props.put("adapterName", adapterName);
            props.put("adapterClass", c.getName());
            props.put("type", "adapter");
            if (adapterClass != null) {
                context.registerService(Class.class.getName(), c, props);
            }
        } catch (Exception e) {
            logger.error("Error loading class for adapterClass: " + adapterClass, e);
        }
    }
}
Also used : FunctionFactoryInterface(com.dexels.navajo.functions.util.FunctionFactoryInterface) Hashtable(java.util.Hashtable)

Example 2 with FunctionFactoryInterface

use of com.dexels.navajo.functions.util.FunctionFactoryInterface in project navajo by Dexels.

the class AbstractCoreExtension method registerAllFunctions.

private void registerAllFunctions(ExtensionDefinition extensionDef) {
    FunctionFactoryInterface fi = FunctionFactoryFactory.getInstance();
    fi.init();
    fi.clearFunctionNames();
    fi.injectExtension(extensionDef);
    final Set<String> functionNames = fi.getFunctionNames(extensionDef);
    for (String functionName : functionNames) {
        FunctionDefinition fd = fi.getDef(extensionDef, functionName);
        registerFunction(context, fi, functionName, fd, extensionDef);
    }
}
Also used : FunctionFactoryInterface(com.dexels.navajo.functions.util.FunctionFactoryInterface) FunctionDefinition(com.dexels.navajo.expression.api.FunctionDefinition)

Example 3 with FunctionFactoryInterface

use of com.dexels.navajo.functions.util.FunctionFactoryInterface in project navajo by Dexels.

the class Version method start.

@Override
public void start(BundleContext bc) throws Exception {
    super.start(bc);
    bundleContext = bc;
    try {
        FunctionFactoryInterface fi = FunctionFactoryFactory.getInstance();
        fi.init();
        fi.clearFunctionNames();
        StandardAdapterFunctionLibrary extensionDef = new StandardAdapterFunctionLibrary();
        registerAll(extensionDef);
        StandardAdapterLibrary library = new StandardAdapterLibrary();
        registerAll(library);
    } catch (Throwable e) {
        logger.error("Trouble starting NavajoAdapters bundle", e);
    }
}
Also used : FunctionFactoryInterface(com.dexels.navajo.functions.util.FunctionFactoryInterface) StandardAdapterLibrary(com.dexels.navajo.adapter.StandardAdapterLibrary) StandardAdapterFunctionLibrary(com.dexels.navajo.adapter.functions.StandardAdapterFunctionLibrary)

Aggregations

FunctionFactoryInterface (com.dexels.navajo.functions.util.FunctionFactoryInterface)3 StandardAdapterLibrary (com.dexels.navajo.adapter.StandardAdapterLibrary)1 StandardAdapterFunctionLibrary (com.dexels.navajo.adapter.functions.StandardAdapterFunctionLibrary)1 FunctionDefinition (com.dexels.navajo.expression.api.FunctionDefinition)1 Hashtable (java.util.Hashtable)1