use of org.cristalise.kernel.process.resource.DefaultResourceImportHandler in project kernel by cristal-ise.
the class Gateway method getResourceImportHandler.
/**
* Retrieves the ResourceImportHandler available for the resource type. It creates a new if configured
* or falls back to the default one provided in the kernel
*
* @param resType the type o the Resource
* @return the initialised ResourceImportHandler
*/
public static ResourceImportHandler getResourceImportHandler(BuiltInResources resType) throws Exception {
if (resourceImportHandlerCache.containsKey(resType))
return resourceImportHandlerCache.get(resType);
ResourceImportHandler handler = null;
if (Gateway.getProperties().containsKey("ResourceImportHandler." + resType)) {
try {
handler = (ResourceImportHandler) Gateway.getProperties().getInstance("ResourceImportHandler." + resType);
} catch (Exception ex) {
Logger.error(ex);
Logger.error("Exception loading ResourceHandler for " + resType + ". Using default.");
}
}
if (handler == null)
handler = new DefaultResourceImportHandler(resType);
resourceImportHandlerCache.put(resType, handler);
return handler;
}
Aggregations