Revision 398

tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngine.java (revision 398)
1
package org.txm.searchengine.core;
2

  
3
import org.txm.Engine;
4

  
5
public abstract class SearchEngine implements Engine {
6

  
7
	public static final String EXTENSION_POINT_ID = SearchEngine.class.getCanonicalName();
8

  
9
	@Override
10
	public abstract String getName();
11
}
0 12

  
tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/Activator.java (revision 398)
1
package org.txm.searchengine.core;
2

  
3
import org.osgi.framework.BundleActivator;
4
import org.osgi.framework.BundleContext;
5

  
6
public class Activator implements BundleActivator {
7

  
8
	private static BundleContext context;
9

  
10
	static BundleContext getContext() {
11
		return context;
12
	}
13

  
14
	/*
15
	 * (non-Javadoc)
16
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
17
	 */
18
	public void start(BundleContext bundleContext) throws Exception {
19
		Activator.context = bundleContext;
20
	}
21

  
22
	/*
23
	 * (non-Javadoc)
24
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
25
	 */
26
	public void stop(BundleContext bundleContext) throws Exception {
27
		Activator.context = null;
28
	}
29

  
30
}
0 31

  
tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngines.java (revision 398)
1
package org.txm.searchengine.core;
2

  
3
import org.eclipse.core.runtime.CoreException;
4
import org.eclipse.core.runtime.IConfigurationElement;
5
import org.eclipse.core.runtime.Platform;
6
import org.txm.Engine;
7
import org.txm.EngineType;
8
import org.txm.EnginesManager;
9

  
10
public class SearchEngines extends EnginesManager<SearchEngine> {
11

  
12
	@Override
13
	public boolean startEngines() {
14
		for (Engine e : engines.values()) {
15
			SearchEngine se = (SearchEngine)e;
16
			System.out.println("Starting searchengine: "+ se.getName());
17
		}
18
		return false;
19
	}
20

  
21
	@Override
22
	public boolean stopEngines() {
23
		// TODO Auto-generated method stub
24
		return false;
25
	}
26

  
27
	@Override
28
	public EngineType getEnginesType() {
29
		return EngineType.SEARCH;
30
	}
31

  
32
	public static SearchEngine getCQPEngine() {
33
		return (SearchEngine) engines.get("CQP");
34
	}
35

  
36
	public static SearchEngine getTIGERSearchEngine() {
37
		return (SearchEngine) engines.get("TIGERSearch");
38
	}
39

  
40
	@Override
41
	protected boolean fetchEngines() {
42
		IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(SearchEngine.EXTENSION_POINT_ID);
43

  
44
		for (int i = 0; i < contributions.length; i++) {
45
			try {
46
				SearchEngine e = (SearchEngine)contributions[i].createExecutableExtension("class"); //$NON-NLS-1$
47
				// register something with the SearchEngine ?
48
				engines.put(e.getName(), e);
49
			} catch(CoreException e) {
50
				e.printStackTrace();
51
			} 
52
		}
53
		return false;
54
	}
55
}
0 56

  
tmp/org.txm.searchengine.core/build.properties (revision 398)
1
source.. = src/
2
output.. = bin/
3
bin.includes = META-INF/,\
4
               .
0 5

  
tmp/org.txm.searchengine.core/.settings/org.eclipse.jdt.core.prefs (revision 398)
1
eclipse.preferences.version=1
2
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
4
org.eclipse.jdt.core.compiler.compliance=1.6
5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7
org.eclipse.jdt.core.compiler.source=1.6
0 8

  
tmp/org.txm.searchengine.core/.classpath (revision 398)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
0 8

  
tmp/org.txm.searchengine.core/META-INF/MANIFEST.MF (revision 398)
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: Searchengine core
4
Bundle-SymbolicName: org.txm.searchengine.core
5
Bundle-Version: 1.0.0.qualifier
6
Bundle-Activator: org.txm.searchengine.core.Activator
7
Require-Bundle: org.eclipse.core.runtime,
8
 org.txm.core;bundle-version="0.7.0"
9
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
10
Bundle-ActivationPolicy: lazy
11
Export-Package: org.txm.searchengine.core
0 12

  
tmp/org.txm.searchengine.core/.project (revision 398)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.txm.searchengine.core</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
	</buildSpec>
24
	<natures>
25
		<nature>org.eclipse.pde.PluginNature</nature>
26
		<nature>org.eclipse.jdt.core.javanature</nature>
27
	</natures>
28
</projectDescription>
0 29

  

Also available in: Unified diff