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