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"); }
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); } }
/** * 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); }
/** * 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"); }