View Javadoc

1   //
2   //  ========================================================================
3   //  Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
4   //  ------------------------------------------------------------------------
5   //  All rights reserved. This program and the accompanying materials
6   //  are made available under the terms of the Eclipse Public License v1.0
7   //  and Apache License v2.0 which accompanies this distribution.
8   //
9   //      The Eclipse Public License is available at
10  //      http://www.eclipse.org/legal/epl-v10.html
11  //
12  //      The Apache License v2.0 is available at
13  //      http://www.opensource.org/licenses/apache2.0.php
14  //
15  //  You may elect to redistribute this code under either of these licenses.
16  //  ========================================================================
17  //
18  
19  package org.eclipse.jetty.osgi.boot.jsp;
20  
21  import org.eclipse.jetty.osgi.boot.BundleWebAppProvider;
22  import org.eclipse.jetty.osgi.boot.internal.webapp.WebBundleTrackerCustomizer;
23  import org.eclipse.jetty.osgi.boot.jasper.PluggableWebAppRegistrationCustomizerImpl;
24  import org.eclipse.jetty.osgi.boot.jasper.WebappRegistrationCustomizerImpl;
25  import org.osgi.framework.BundleActivator;
26  import org.osgi.framework.BundleContext;
27  
28  /**
29   * Pseudo fragment activator. Called by the main org.eclipse.jetty.osgi.boot
30   * bundle. Please note: this is not a real BundleActivator. Simply something
31   * called back by the host bundle.
32   * <p>
33   * It must be placed in the org.eclipse.jetty.osgi.boot.jsp package: this is
34   * because org.eclipse.jetty.osgi.boot.jsp is the symbolic-name of this
35   * fragment. From that name, the PackageadminTracker will call this class. IN a
36   * different package it won't be called.
37   * </p>
38   */
39  public class FragmentActivator implements BundleActivator
40  {
41      /**
42       * 
43       */
44      public void start(BundleContext context) throws Exception
45      {
46          System.setProperty("org.apache.jasper.compiler.disablejsr199", Boolean.TRUE.toString());
47          WebBundleTrackerCustomizer.JSP_REGISTRATION_HELPERS.add(new WebappRegistrationCustomizerImpl());
48          WebBundleTrackerCustomizer.JSP_REGISTRATION_HELPERS.add(new PluggableWebAppRegistrationCustomizerImpl());
49          //Put in the support for the tag libs
50          addTagLibSupport();
51        
52      }
53  
54      /**
55       * 
56       */
57      public void stop(BundleContext context) throws Exception
58      {
59  
60      }
61      
62      public void addTagLibSupport ()
63      {
64          String[] defaultConfigurations = new String[BundleWebAppProvider.getDefaultConfigurations().length+1];
65          System.arraycopy(BundleWebAppProvider.getDefaultConfigurations(), 0, defaultConfigurations, 0, BundleWebAppProvider.getDefaultConfigurations().length);
66          defaultConfigurations[defaultConfigurations.length-1] = "org.eclipse.jetty.osgi.boot.jsp.TagLibOSGiConfiguration";
67          BundleWebAppProvider.setDefaultConfigurations(defaultConfigurations);
68      }
69  }