blob: a4132f4c470225c670eb6bfa857715698a81e83b [file] [log] [blame]
/***********************************************************************************************************************
* Copyright (c) 2008 empolis GmbH and brox IT Solutions GmbH. All rights reserved. This program and the accompanying
* materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: August Georg Schmidt (brox IT Solutions GmbH) - initial API and implementation
**********************************************************************************************************************/
package org.eclipse.smila.search;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.smila.tools.XMLUtils;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
/**
* @author August Georg Schmidt (BROX)
*
*/
public class EIFActivator implements BundleActivator {
/**
* name of bundle. Used in configuration reading.
*/
public static final String BUNDLE_NAME = "org.eclipse.smila.search";
/**
* Whether schemas have been initialized.
*/
private static boolean schemasInitialized;
/**
* Bundle context.
*/
public static BundleContext s_bundleContext;
/**
* {@inheritDoc}
*
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
s_bundleContext = context;
}
/**
* {@inheritDoc}
*
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
; // do nothing
}
public synchronized static void registerSchemas() {
if (schemasInitialized) {
return;
}
final Log log = LogFactory.getLog(EIFActivator.class);
try {
final String[] schemas =
{ "ParameterDescriptions.xsd", "ParameterSet.xsd", "ParameterDefinition.xsd", "ErrorMessage.xsd",
"DDConfigDateFieldHighlightingParameter.xsd", "DDConfigNumberFieldHighlightingParameter.xsd",
"DDConfigTextFieldHighlightingParameter.xsd", "AnyFinderSearchDateFieldParameter.xsd",
"AnyFinderSearchNumberFieldParameter.xsd", "AnyFinderSearchTextFieldParameter.xsd",
"AnyFinderEngineData.xsd", "AnyFinderOperation.xsd", "SearchParameterObjects.xsd",
"DataDictionaryConfiguration.xsd", "DataDictionaryConnection.xsd", "DataDictionaryMetaData.xsd",
"IndexStructure.xsd", "Queue.xsd", "RapidDeployerAdvancedSearchTemplateFields.xsd",
"RapidDeployerIndexStructure.xsd", "RecordTransformationDefinition.xsd",
"RecordTransformationProcess.xsd", "RecordTransformationSet.xsd", "SimpleTypeDefs.xsd",
"AnyFinderAdvancedSearch.xsd", "AnyFinderDataDictionary.xsd", "AnyFinderOperationResult.xsd",
"AnyFinderSearch.xsd", "AnyFinderSearchResult.xsd", "FieldTemplates.xsd", "SearchTemplates.xsd",
"AnyFinderFieldRequest.xsd", "AnyFinderFieldResult.xsd", "SearchPage.xsd", "NodeTransformerRegistry.xsd",
"HighlightingTransformerRegistry.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);
}
}
}
}