Search in sources :

Example 1 with ExtensionDefinition

use of navajo.ExtensionDefinition in project navajo by Dexels.

the class JarFunctionFactory method init.

@Override
public void init() {
    Map<String, FunctionDefinition> fuds = getDefaultConfig();
    if (fuds == null) {
        fuds = new HashMap<>();
        setDefaultConfig(fuds);
    }
    ClassLoader myClassLoader = null;
    if (DispatcherFactory.getInstance() != null) {
        myClassLoader = DispatcherFactory.getInstance().getNavajoConfig().getClassloader();
    } else {
        myClassLoader = getClass().getClassLoader();
    }
    try {
        Iterator<?> iter = java.util.ServiceLoader.load(Class.forName("navajo.ExtensionDefinition", true, myClassLoader), myClassLoader).iterator();
        while (iter.hasNext()) {
            ExtensionDefinition ed = (ExtensionDefinition) iter.next();
            readDefinitionFile(fuds, ed);
        }
    } catch (Throwable e) {
        logger.debug("ServiceLookup failed. Normal in OSGi environment", e);
        if (!Version.osgiActive()) {
            logger.error("But OSGi isn't active, so something is definitely wrong.", e);
        }
    }
}
Also used : ExtensionDefinition(navajo.ExtensionDefinition) FunctionDefinition(com.dexels.navajo.expression.api.FunctionDefinition)

Example 2 with ExtensionDefinition

use of navajo.ExtensionDefinition in project navajo by Dexels.

the class MapDefinitionInterrogatorImpl method addExtentionDefinition.

public void addExtentionDefinition(String extension) throws Exception {
    Class<ExtensionDefinition> c = (Class<ExtensionDefinition>) Class.forName(extension);
    ExtensionDefinition ed = c.getDeclaredConstructor().newInstance();
    mapMetaData.readExtentionDefinition(ed);
}
Also used : ExtensionDefinition(navajo.ExtensionDefinition)

Example 3 with ExtensionDefinition

use of navajo.ExtensionDefinition in project navajo by Dexels.

the class MapMetaData method readConfig.

private void readConfig() throws ClassNotFoundException, KeywordException {
    synchronized (instance) {
        if (DispatcherFactory.getInstance() != null) {
            myClassLoader = DispatcherFactory.getInstance().getNavajoConfig().getClassloader();
        } else if (myClassLoader == null) {
            myClassLoader = getClass().getClassLoader();
        }
        Iterator<?> iter = null;
        try {
            ServiceLoader<ExtensionDefinition> loader = ServiceLoader.load(ExtensionDefinition.class, myClassLoader);
            iter = loader.iterator();
            // myClassLoader);
            while (iter.hasNext()) {
                ExtensionDefinition ed = (ExtensionDefinition) iter.next();
                readExtentionDefinition(ed);
            }
        } catch (IOException e) {
            logger.warn("Unable to lookup providers in lecagy service. Normal in OSGi.");
        }
    }
}
Also used : ExtensionDefinition(navajo.ExtensionDefinition) IOException(java.io.IOException)

Aggregations

ExtensionDefinition (navajo.ExtensionDefinition)3 FunctionDefinition (com.dexels.navajo.expression.api.FunctionDefinition)1 IOException (java.io.IOException)1