Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-1840

URLDeploymentScanner: instant deploy and undeploy of a added resp. removed URL would be useful

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Obsolete
    • Icon: Minor Minor
    • No Release
    • JBossAS-4.0.2 Final
    • None
    • None

      Hi,
      it would be cool, if the URLDeploymentScanner would support a method that allows to add a new URL and
      to make an instant deployment of this URL (resp. to remove a URL and instantly to undeploy the URL).

      I implemented it this way:
      /**

      • adds the url to the url list and if required deploys by performing a
      • scan.
      • @param url
      • the added url
      • @param scan
      • true if scan is required
        */
        public void addURL(String url, Boolean scan) throws Exception {

      // first we remove the url, otherwise deployment of the same url let the
      // urlList grow
      if (url == null)
      throw new NullArgumentException("url");
      urlList.remove(makeURL(url));
      addURL(url);
      log.info("Added URL called <" + url + ">");
      if (scan.booleanValue())

      { doScan(); log.info("Deployed URL called <" + url + ">"); }

      }
      /**

      • removes the URL from the urllist and performs a scan if required.
      • @param url
      • the removed url
      • @param scan
      • true if scan is required
        */

      public void removeURL(String url, Boolean scan) throws Exception {

      super.removeURL(url);
      log.info("Removed URL called <" + url + ">");
      if (scan.booleanValue())

      { doScan(); log.info("Undeployed URL called <" + url + ">"); }

      }

      /**

      • performs a scan
      • @throws Exception
        */
        protected void doScan() throws Exception {
        /*
      • scanning has to run in a doPrivileged block because several
      • permissions are needed to deploy its not maintainable to grant all
      • those permission to a principal in order to execute addUrl the
      • principal must have MBeanPermissions those permissions are granted.
        */
        try {
        AccessController.doPrivileged(new PrivilegedExceptionAction()
        Unknown macro: { public Object run() throws Exception { scan(); return null; } }

        );
        } catch (PrivilegedActionException e)

        { throw e.getException(); }

        }

      Regards

              dandread1@redhat.com Dimitrios Andreadis
              wv-javacoder Roland Räz (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 1 hour
                  1h
                  Remaining:
                  Remaining Estimate - 1 hour
                  1h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified