xref: /AOO41X/main/xmlhelp/source/com/sun/star/help/HelpComponent.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir package com.sun.star.help;
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir import com.sun.star.lib.uno.helper.Factory;
31*cdf0e10cSrcweir import com.sun.star.lang.XSingleComponentFactory;
32*cdf0e10cSrcweir import com.sun.star.registry.XRegistryKey;
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir /*
35*cdf0e10cSrcweir import com.sun.star.lib.uno.helper.Factory;
36*cdf0e10cSrcweir import com.sun.star.lang.XMultiComponentFactory;
37*cdf0e10cSrcweir import com.sun.star.lang.XSingleComponentFactory;
38*cdf0e10cSrcweir import com.sun.star.lib.uno.helper.WeakBase;
39*cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
40*cdf0e10cSrcweir import com.sun.star.uno.XComponentContext;
41*cdf0e10cSrcweir import com.sun.star.registry.XRegistryKey;
42*cdf0e10cSrcweir import com.sun.star.lang.XInitialization;
43*cdf0e10cSrcweir import com.sun.star.lang.XTypeProvider;
44*cdf0e10cSrcweir import com.sun.star.lang.XServiceInfo;
45*cdf0e10cSrcweir import com.sun.star.uno.Type;
46*cdf0e10cSrcweir import com.sun.star.uno.Any;
47*cdf0e10cSrcweir import com.sun.star.uno.AnyConverter;
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir import org.apache.lucene.analysis.Analyzer;
50*cdf0e10cSrcweir import org.apache.lucene.analysis.standard.StandardAnalyzer;
51*cdf0e10cSrcweir import org.apache.lucene.document.Document;
52*cdf0e10cSrcweir import org.apache.lucene.index.FilterIndexReader;
53*cdf0e10cSrcweir import org.apache.lucene.index.IndexReader;
54*cdf0e10cSrcweir import org.apache.lucene.index.Term;
55*cdf0e10cSrcweir import org.apache.lucene.queryParser.QueryParser;
56*cdf0e10cSrcweir import org.apache.lucene.search.Hits;
57*cdf0e10cSrcweir import org.apache.lucene.search.IndexSearcher;
58*cdf0e10cSrcweir import org.apache.lucene.search.Query;
59*cdf0e10cSrcweir import org.apache.lucene.search.Searcher;
60*cdf0e10cSrcweir import org.apache.lucene.search.TermQuery;
61*cdf0e10cSrcweir import org.apache.lucene.search.WildcardQuery;
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir import com.sun.star.script.XInvocation;
64*cdf0e10cSrcweir import com.sun.star.beans.XIntrospectionAccess;
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir import java.io.FileOutputStream;
67*cdf0e10cSrcweir import java.io.PrintStream;
68*cdf0e10cSrcweir import java.io.File;
69*cdf0e10cSrcweir */
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir /** This class capsulates the class, that implements the minimal component and a
72*cdf0e10cSrcweir  * factory for creating the service (<CODE>__getComponentFactory</CODE>).
73*cdf0e10cSrcweir  */
74*cdf0e10cSrcweir public class HelpComponent
75*cdf0e10cSrcweir {
76*cdf0e10cSrcweir     /**
77*cdf0e10cSrcweir      * Gives a factory for creating the service.
78*cdf0e10cSrcweir      * This method is called by the <code>JavaLoader</code>
79*cdf0e10cSrcweir      * <p>
80*cdf0e10cSrcweir      * @return  returns a <code>XSingleComponentFactory</code> for creating
81*cdf0e10cSrcweir      *          the component
82*cdf0e10cSrcweir      * @param   sImplName the name of the implementation for which a
83*cdf0e10cSrcweir      *          service is desired
84*cdf0e10cSrcweir      * @see     com.sun.star.comp.loader.JavaLoader
85*cdf0e10cSrcweir      */
86*cdf0e10cSrcweir     public static XSingleComponentFactory __getComponentFactory(String sImplName)
87*cdf0e10cSrcweir     {
88*cdf0e10cSrcweir         XSingleComponentFactory xFactory = null;
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir         if ( sImplName.equals( HelpSearch._HelpSearch.class.getName() ) )
91*cdf0e10cSrcweir             xFactory = Factory.createComponentFactory(HelpSearch._HelpSearch.class,
92*cdf0e10cSrcweir                                              HelpSearch._HelpSearch.getServiceNames());
93*cdf0e10cSrcweir         else if ( sImplName.equals( HelpIndexer.class.getName() ) )
94*cdf0e10cSrcweir             xFactory = Factory.createComponentFactory(HelpIndexer.class,
95*cdf0e10cSrcweir                                              HelpIndexer.getServiceNames());
96*cdf0e10cSrcweir         return xFactory;
97*cdf0e10cSrcweir     }
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 	/** This method is a member of the interface for initializing an object
100*cdf0e10cSrcweir 	 * directly after its creation.
101*cdf0e10cSrcweir 	 * @param object This array of arbitrary objects will be passed to the
102*cdf0e10cSrcweir 	 * component after its creation.
103*cdf0e10cSrcweir 	 * @throws Exception Every exception will not be handled, but will be
104*cdf0e10cSrcweir 	 * passed to the caller.
105*cdf0e10cSrcweir 	 */
106*cdf0e10cSrcweir 	public void initialize( Object[] object )
107*cdf0e10cSrcweir 		throws com.sun.star.uno.Exception
108*cdf0e10cSrcweir 	{
109*cdf0e10cSrcweir 		/* The component describes what arguments its expected and in which
110*cdf0e10cSrcweir 		 * order!At this point you can read the objects and can intialize
111*cdf0e10cSrcweir 		 * your component using these objects.
112*cdf0e10cSrcweir 		 */
113*cdf0e10cSrcweir 	}
114*cdf0e10cSrcweir }
115