Exemplo n.º 1
0
  public void restart(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    // First we need to stop the framework
    OSGIUtil.getInstance().stopFramework();

    // Now we need to initialize it
    OSGIUtil.getInstance().initializeFramework();

    // Send a respose
    writeSuccess(response, "OSGI Framework Restarted");
  }
Exemplo n.º 2
0
  public void start(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    String bundleID = request.getParameter("bundleId");
    try {
      try {
        OSGIUtil.getInstance().getBundleContext().getBundle(new Long(bundleID)).start();
      } catch (NumberFormatException e) {
        OSGIUtil.getInstance().getBundleContext().getBundle(bundleID).start();
      }
    } catch (BundleException e) {
      Logger.error(OSGIAJAX.class, e.getMessage(), e);
      throw new ServletException(e.getMessage() + " Unable to start bundle", e);
    }
  }
Exemplo n.º 3
0
  /**
   * Returns the packages inside the <strong>osgi-extra.conf</strong> file, those packages are the
   * value for the OSGI configuration property
   * <strong>org.osgi.framework.system.packages.extra</strong>.
   *
   * @param request
   * @param response
   * @throws ServletException
   * @throws IOException
   */
  public void getExtraPackages(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    // Read the list of the dotCMS exposed packages to the OSGI context
    String extraPackages = OSGIUtil.getInstance().getExtraOSGIPackages();

    // Send a respose
    writeSuccess(response, extraPackages);
  }
Exemplo n.º 4
0
  /**
   * Overrides the content of the <strong>osgi-extra.conf</strong> file
   *
   * @param request
   * @param response
   * @throws ServletException
   * @throws IOException
   */
  public void modifyExtraPackages(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    // Get the packages from the form
    String extraPackages = request.getParameter("packages");

    // Override the file with the values we just read
    BufferedWriter writer =
        new BufferedWriter(new FileWriter(OSGIUtil.getInstance().FELIX_EXTRA_PACKAGES_FILE));
    writer.write(extraPackages);
    writer.close();

    // Send a response
    writeSuccess(response, "OSGI Extra Packages Saved");
  }