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);
}
}
}
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);
}
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.");
}
}
}
Aggregations