1*57c10a96SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*57c10a96SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*57c10a96SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*57c10a96SAndrew Rist * distributed with this work for additional information 6*57c10a96SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*57c10a96SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*57c10a96SAndrew Rist * "License"); you may not use this file except in compliance 9*57c10a96SAndrew Rist * with the License. You may obtain a copy of the License at 10*57c10a96SAndrew Rist * 11*57c10a96SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*57c10a96SAndrew Rist * 13*57c10a96SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*57c10a96SAndrew Rist * software distributed under the License is distributed on an 15*57c10a96SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*57c10a96SAndrew Rist * KIND, either express or implied. See the License for the 17*57c10a96SAndrew Rist * specific language governing permissions and limitations 18*57c10a96SAndrew Rist * under the License. 19*57c10a96SAndrew Rist * 20*57c10a96SAndrew Rist *************************************************************/ 21*57c10a96SAndrew Rist 22*57c10a96SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir package com.sun.star.help; 25cdf0e10cSrcweir 26cdf0e10cSrcweir import com.sun.star.lib.uno.helper.Factory; 27cdf0e10cSrcweir import com.sun.star.lang.XSingleComponentFactory; 28cdf0e10cSrcweir import com.sun.star.registry.XRegistryKey; 29cdf0e10cSrcweir 30cdf0e10cSrcweir /* 31cdf0e10cSrcweir import com.sun.star.lib.uno.helper.Factory; 32cdf0e10cSrcweir import com.sun.star.lang.XMultiComponentFactory; 33cdf0e10cSrcweir import com.sun.star.lang.XSingleComponentFactory; 34cdf0e10cSrcweir import com.sun.star.lib.uno.helper.WeakBase; 35cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 36cdf0e10cSrcweir import com.sun.star.uno.XComponentContext; 37cdf0e10cSrcweir import com.sun.star.registry.XRegistryKey; 38cdf0e10cSrcweir import com.sun.star.lang.XInitialization; 39cdf0e10cSrcweir import com.sun.star.lang.XTypeProvider; 40cdf0e10cSrcweir import com.sun.star.lang.XServiceInfo; 41cdf0e10cSrcweir import com.sun.star.uno.Type; 42cdf0e10cSrcweir import com.sun.star.uno.Any; 43cdf0e10cSrcweir import com.sun.star.uno.AnyConverter; 44cdf0e10cSrcweir 45cdf0e10cSrcweir import org.apache.lucene.analysis.Analyzer; 46cdf0e10cSrcweir import org.apache.lucene.analysis.standard.StandardAnalyzer; 47cdf0e10cSrcweir import org.apache.lucene.document.Document; 48cdf0e10cSrcweir import org.apache.lucene.index.FilterIndexReader; 49cdf0e10cSrcweir import org.apache.lucene.index.IndexReader; 50cdf0e10cSrcweir import org.apache.lucene.index.Term; 51cdf0e10cSrcweir import org.apache.lucene.queryParser.QueryParser; 52cdf0e10cSrcweir import org.apache.lucene.search.Hits; 53cdf0e10cSrcweir import org.apache.lucene.search.IndexSearcher; 54cdf0e10cSrcweir import org.apache.lucene.search.Query; 55cdf0e10cSrcweir import org.apache.lucene.search.Searcher; 56cdf0e10cSrcweir import org.apache.lucene.search.TermQuery; 57cdf0e10cSrcweir import org.apache.lucene.search.WildcardQuery; 58cdf0e10cSrcweir 59cdf0e10cSrcweir import com.sun.star.script.XInvocation; 60cdf0e10cSrcweir import com.sun.star.beans.XIntrospectionAccess; 61cdf0e10cSrcweir 62cdf0e10cSrcweir import java.io.FileOutputStream; 63cdf0e10cSrcweir import java.io.PrintStream; 64cdf0e10cSrcweir import java.io.File; 65cdf0e10cSrcweir */ 66cdf0e10cSrcweir 67cdf0e10cSrcweir /** This class capsulates the class, that implements the minimal component and a 68cdf0e10cSrcweir * factory for creating the service (<CODE>__getComponentFactory</CODE>). 69cdf0e10cSrcweir */ 70cdf0e10cSrcweir public class HelpComponent 71cdf0e10cSrcweir { 72cdf0e10cSrcweir /** 73cdf0e10cSrcweir * Gives a factory for creating the service. 74cdf0e10cSrcweir * This method is called by the <code>JavaLoader</code> 75cdf0e10cSrcweir * <p> 76cdf0e10cSrcweir * @return returns a <code>XSingleComponentFactory</code> for creating 77cdf0e10cSrcweir * the component 78cdf0e10cSrcweir * @param sImplName the name of the implementation for which a 79cdf0e10cSrcweir * service is desired 80cdf0e10cSrcweir * @see com.sun.star.comp.loader.JavaLoader 81cdf0e10cSrcweir */ __getComponentFactory(String sImplName)82cdf0e10cSrcweir public static XSingleComponentFactory __getComponentFactory(String sImplName) 83cdf0e10cSrcweir { 84cdf0e10cSrcweir XSingleComponentFactory xFactory = null; 85cdf0e10cSrcweir 86cdf0e10cSrcweir if ( sImplName.equals( HelpSearch._HelpSearch.class.getName() ) ) 87cdf0e10cSrcweir xFactory = Factory.createComponentFactory(HelpSearch._HelpSearch.class, 88cdf0e10cSrcweir HelpSearch._HelpSearch.getServiceNames()); 89cdf0e10cSrcweir else if ( sImplName.equals( HelpIndexer.class.getName() ) ) 90cdf0e10cSrcweir xFactory = Factory.createComponentFactory(HelpIndexer.class, 91cdf0e10cSrcweir HelpIndexer.getServiceNames()); 92cdf0e10cSrcweir return xFactory; 93cdf0e10cSrcweir } 94cdf0e10cSrcweir 95cdf0e10cSrcweir /** This method is a member of the interface for initializing an object 96cdf0e10cSrcweir * directly after its creation. 97cdf0e10cSrcweir * @param object This array of arbitrary objects will be passed to the 98cdf0e10cSrcweir * component after its creation. 99cdf0e10cSrcweir * @throws Exception Every exception will not be handled, but will be 100cdf0e10cSrcweir * passed to the caller. 101cdf0e10cSrcweir */ initialize( Object[] object )102cdf0e10cSrcweir public void initialize( Object[] object ) 103cdf0e10cSrcweir throws com.sun.star.uno.Exception 104cdf0e10cSrcweir { 105cdf0e10cSrcweir /* The component describes what arguments its expected and in which 106cdf0e10cSrcweir * order!At this point you can read the objects and can intialize 107cdf0e10cSrcweir * your component using these objects. 108cdf0e10cSrcweir */ 109cdf0e10cSrcweir } 110cdf0e10cSrcweir } 111