List of usage examples for org.apache.commons.logging Log isErrorEnabled
boolean isErrorEnabled();
From source file:org.eclipse.smila.search.datadictionary.DataDictionaryAccess.java
/** * DataDicitonaryAccess.//from w w w . j a va 2 s.c o m * * @return - an access object. */ public static DataDictionaryAccess getInstance() { final Log log = LogFactory.getLog(DataDictionaryAccess.class); DataDictionaryAccess[] types; try { types = getTypes(); if (types.length != 1) { if (log.isWarnEnabled()) { log.warn("invalid data dictionary access count [" + types.length + "]"); } return null; } return types[0]; } catch (final DataDictionaryException e) { if (log.isErrorEnabled()) { log.error(e); } return null; } }
From source file:org.eclipse.smila.search.datadictionary.DataDictionaryAccess.java
/** * Get all available IRM types./* w ww .ja v a 2 s.c om*/ * * @return IRM types. * @throws DataDictionaryException * DataDictionaryException. */ public static DataDictionaryAccess[] getTypes() throws DataDictionaryException { if (s_cachedDataDictionaryAccess != null) { return s_cachedDataDictionaryAccess; } final Log log = LogFactory.getLog(DataDictionaryAccess.class); final List<DataDictionaryAccess> found = new ArrayList<DataDictionaryAccess>(); // TODO: Check why the next line is needed. // found.add(UNKNOWN); final IExtension[] extensions = Platform.getExtensionRegistry() .getExtensionPoint(EXTENSION_POINT_NAME_DATA_DICTIONARY_ACCESS).getExtensions(); for (int i = 0; i < extensions.length; i++) { final IExtension extension = extensions[i]; final IConfigurationElement[] configElements = extension.getConfigurationElements(); for (int j = 0; j < configElements.length; j++) { final IConfigurationElement configurationElement = configElements[j]; DataDictionaryAccess clazz = null; try { final Object obj = configurationElement.createExecutableExtension("Clazz"); clazz = (DataDictionaryAccess) obj; } catch (final Exception exception) { if (log.isErrorEnabled()) { if (configurationElement != null) { log.error("Failed to instantiate data dictionary access"); } else { log.error("Unknown!"); } } throw new DataDictionaryException("unable to load data dictionary access", exception); } if (clazz != null) { found.add(clazz); } } } s_cachedDataDictionaryAccess = found.toArray(new DataDictionaryAccess[0]); return s_cachedDataDictionaryAccess; }
From source file:org.eclipse.smila.search.datadictionary.DataDictionaryAccess.java
/** * Parse configuration and return according IRMType. * //www . ja v a 2s.co m * @param configurationElement * Configuration element. * @param ordinal * Ordinal. * @return Type name. */ public static String parseType(IConfigurationElement configurationElement, int ordinal) { if (!configurationElement.getName().equals("DataDictionaryAccess")) { return null; } final Log log = LogFactory.getLog(DataDictionaryAccess.class); try { String name = configurationElement.getAttribute("Clazz"); if (name == null) { name = "[missing attribute name]"; } return name; } catch (final Exception e) { String name = configurationElement.getAttribute("Clazz"); if (name == null) { name = "[missing attribute name]"; } final String msg = "Failed to load StrategyType named " + name + " in " + configurationElement.getDeclaringExtension().getNamespaceIdentifier(); if (log.isErrorEnabled()) { log.error(msg, e); } return null; } }
From source file:org.eclipse.smila.search.EIFActivator.java
public synchronized static void registerSchemas() { if (schemasInitialized) { return;//www.j av a2s .c o m } final Log log = LogFactory.getLog(EIFActivator.class); try { final String[] schemas = { "ParameterDescriptions.xsd", "ParameterSet.xsd", "ParameterDefinition.xsd", "ErrorMessage.xsd", "AnyFinderSearchDateFieldParameter.xsd", "AnyFinderSearchNumberFieldParameter.xsd", "AnyFinderSearchTextFieldParameter.xsd", "AnyFinderEngineData.xsd", "SearchParameterObjects.xsd", "DataDictionaryConfiguration.xsd", "DataDictionaryConnection.xsd", "IndexStructure.xsd", "Queue.xsd", "RapidDeployerAdvancedSearchTemplateFields.xsd", "RapidDeployerIndexStructure.xsd", "RecordTransformationDefinition.xsd", "RecordTransformationProcess.xsd", "RecordTransformationSet.xsd", "SimpleTypeDefs.xsd", "AnyFinderAdvancedSearch.xsd", "AnyFinderDataDictionary.xsd", "AnyFinderSearch.xsd", "FieldTemplates.xsd", "SearchTemplates.xsd", "AnyFinderFieldRequest.xsd", "HighlightingTransformerRegistry.xsd", "NodeTransformerRegistry.xsd", "TransformerRegistry.xsd" }; XMLUtils.clearGrammarCache(); // read all schemas in defined order for (final String schema : schemas) { XMLUtils.loadSchema("../xml/" + schema, EIFActivator.s_bundleContext); } schemasInitialized = true; } catch (final Exception exception) { if (log.isErrorEnabled()) { log.error(exception); } } }
From source file:org.eclipse.smila.search.plugin.PluginFactory.java
public static Plugin getPlugin() { synchronized (s_object) { final Log log = LogFactory.getLog(PluginFactory.class); if (s_plugin == null) { try { initialize();//from ww w . j ava 2s.c om } catch (final PluginException exception) { if (log.isErrorEnabled()) { log.error(exception); } } } return s_plugin; } }
From source file:org.eclipse.smila.search.plugin.PluginFactory.java
public static Plugin getInstance() { // TODO: implement correctly final Log log = LogFactory.getLog(PluginFactory.class); Plugin[] types;//from w ww. j av a 2s . c o m try { types = getTypes(); if (types.length != 1) { if (log.isWarnEnabled()) { log.warn("invalid plugin count [" + types.length + "]"); } return null; } return types[0]; } catch (final PluginException e) { if (log.isErrorEnabled()) { log.error(e); } return null; } }
From source file:org.eclipse.smila.search.plugin.PluginFactory.java
/** * Get all available IRM types./*from ww w. ja va 2s .co m*/ * * @return IRM types. * @throws PluginException - */ public static Plugin[] getTypes() throws PluginException { final Log log = LogFactory.getLog(PluginFactory.class); final List<Plugin> found = new ArrayList<Plugin>(); // TODO: Check why the next line is needed. // found.add(UNKNOWN); final IExtension[] extensions = Platform.getExtensionRegistry() .getExtensionPoint(EXTENSION_POINT_NAME_PLUGIN).getExtensions(); for (int i = 0; i < extensions.length; i++) { final IExtension extension = extensions[i]; final IConfigurationElement[] configElements = extension.getConfigurationElements(); for (int j = 0; j < configElements.length; j++) { final IConfigurationElement configurationElement = configElements[j]; final String typeName = parseType(configurationElement, found.size()); Plugin clazz = null; try { final Object obj = configurationElement.createExecutableExtension("Clazz"); clazz = (Plugin) obj; } catch (final Exception exception) { if (log.isErrorEnabled()) { if (configurationElement != null) { log.error("Failed to instantiate plugin"); } else { log.error("Unknown!"); } } throw new PluginException("unable to load plugin", exception); } if (clazz != null) { found.add(clazz); } } } return found.toArray(new Plugin[0]); }
From source file:org.eclipse.smila.search.plugin.PluginFactory.java
/** * Parse configuration and return according IRMType. * //ww w .j a v a 2 s. c o m * @param configurationElement * Configuration element. * @param ordinal * Ordinal. * @return Type name. */ public static String parseType(IConfigurationElement configurationElement, int ordinal) { final Log log = LogFactory.getLog(PluginFactory.class); if (!configurationElement.getName().equals("Plugin")) { return null; } try { String name = configurationElement.getAttribute("Clazz"); if (name == null) { name = "[missing attribute name]"; } return name; } catch (final Exception e) { if (log.isErrorEnabled()) { String name = configurationElement.getAttribute("Clazz"); if (name == null) { name = "[missing attribute name]"; } final String msg = "Failed to load plugin named " + name + " in " + configurationElement.getDeclaringExtension().getNamespaceIdentifier(); log.error(msg, e); } return null; } }
From source file:org.eclipse.smila.search.templates.NodeTransformerRegistryController.java
/** * @return DNodeTransformerRegistry/*from ww w. j ava 2 s . c o m*/ */ public static DNodeTransformerRegistry getNodeTransformer() { final Log log = LogFactory.getLog(NodeTransformerRegistryController.class); final Hashtable<String, NodeTransformerType> nodeTransformers = NodeTransformerType.getTypes(); final DNodeTransformerRegistry registry = new DNodeTransformerRegistry(); for (final NodeTransformerType nodeTransformerType : nodeTransformers.values()) { final DNodeTransformer nt = new DNodeTransformer(); nt.setClassName(nodeTransformerType.getClass().getName()); nt.setDescription(nodeTransformerType.getName()); nt.setName(nodeTransformerType.getName()); try { nt.setParameterDefinition(nodeTransformerType.getParameterDefinition()); } catch (final NodeTransformerException exception) { if (log.isErrorEnabled()) { log.error(exception); } } registry.addNodeTransformer(nt); } return registry; }
From source file:org.eclipse.smila.search.templates.NodeTransformerType.java
/** * Load a IRM reference./* w ww.j av a 2 s. c o m*/ * * @return IRM. * @throws NodeTransformerException * Unable to load IRM. */ public NodeTransformer loadNodeTransformer() throws NodeTransformerException { if (_nodeTransformer != null) { return _nodeTransformer; } final Log log = LogFactory.getLog(NodeTransformerType.class); try { final Object obj = _configurationElement.createExecutableExtension(ATT_CLASS_NAME); _nodeTransformer = (NodeTransformer) obj; return _nodeTransformer; } catch (final Exception exception) { if (log.isErrorEnabled()) { if (_configurationElement != null) { log.error(("Failed to instantiate node transformer: " + _configurationElement.getAttribute(ATT_CLASS_NAME) + " in uri: " + _name + " in plugin: " + _configurationElement.getDeclaringExtension().getNamespaceIdentifier())); } else { log.error("Unknown!"); } } throw new NodeTransformerException("unable to load node transformer", exception); } }