You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Activator.java 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.osgi;
  16. import org.apache.poi.extractor.ExtractorFactory;
  17. import org.apache.poi.extractor.MainExtractorFactory;
  18. import org.apache.poi.extractor.ole2.OLE2ScratchpadExtractorFactory;
  19. import org.apache.poi.hslf.usermodel.HSLFSlideShowFactory;
  20. import org.apache.poi.hssf.usermodel.HSSFWorkbookFactory;
  21. import org.apache.poi.ooxml.extractor.POIXMLExtractorFactory;
  22. import org.apache.poi.sl.usermodel.SlideShowFactory;
  23. import org.apache.poi.ss.usermodel.WorkbookFactory;
  24. import org.apache.poi.xslf.usermodel.XSLFSlideShowFactory;
  25. import org.apache.poi.xssf.usermodel.XSSFWorkbookFactory;
  26. import org.osgi.framework.BundleActivator;
  27. import org.osgi.framework.BundleContext;
  28. public class Activator implements BundleActivator {
  29. @Override
  30. public void start(BundleContext context) {
  31. WorkbookFactory.addProvider(new HSSFWorkbookFactory());
  32. WorkbookFactory.addProvider(new XSSFWorkbookFactory());
  33. SlideShowFactory.addProvider(new HSLFSlideShowFactory());
  34. SlideShowFactory.addProvider(new XSLFSlideShowFactory());
  35. ExtractorFactory.addProvider(new OLE2ScratchpadExtractorFactory());
  36. ExtractorFactory.addProvider(new POIXMLExtractorFactory());
  37. ExtractorFactory.addProvider(new MainExtractorFactory());
  38. }
  39. @Override
  40. public void stop(BundleContext context) {
  41. WorkbookFactory.removeProvider(HSSFWorkbookFactory.class);
  42. WorkbookFactory.removeProvider(XSSFWorkbookFactory.class);
  43. SlideShowFactory.removeProvider(HSLFSlideShowFactory.class);
  44. SlideShowFactory.removeProvider(XSLFSlideShowFactory.class);
  45. ExtractorFactory.removeProvider(OLE2ScratchpadExtractorFactory.class);
  46. ExtractorFactory.removeProvider(POIXMLExtractorFactory.class);
  47. ExtractorFactory.removeProvider(MainExtractorFactory.class);
  48. }
  49. }