So - In my last article, I stuck my new Namespace in an OSGi bundle where it did not belong.  I wanted to verify the approach for adding the Namespace, and in my thinking at the time, it was the quickest location to do that.  It worked.  Great - now how do I put it in the "correct" location.

You cannot simply remove the Sling Namespace metadata from the POM and redeploy.  Nope.  Still there.  What I could have done - because the Namespace would be defined somewhere - was simply define it in another OSGi bundle's POM.  But this got me thinking: what if I simply wanted to remove the Namespace altogether?  What then?  Hmmm.

I actually figured this out backwards.  I identified the filesystem files where the Namespaces are stored.  I removed them from there, restarted, et viola... they are stil there.  Why?  Silly Developer, Namespaces are for Bundle's.  Specifically the META-INF/MANIFEST.MF file.  I realized that regardless of what I did to those repository filesystem files, there was something else I needed to do.  When CQ starts back up, the POM's are started, all the Bundle's are going to be scanned for Namespace definitions.  Because I had not figured out yet to remove the Namespace definition from my Bundle/POM, Sling or Felix was simply going to re-register my namespace.  Just a little bit like whack-a-mole.

In order for Namespace(s) to be completely removed from your running Sling / CQ system:

  1. Remove the <Sling-Namespaces> defintion altogether, or just the specific Namespaces from the maven bundle plugin defintion and rebuild
  2. Redeploy your OSGi bundle
  3. Stop your running system
  4. Edit file: ${cq-install}/crx-quickstart/repository/repository/namespaces/ and remove the Namespace definition
  5. Edit file: ${cq-install}/crx-quickstart/repository/repository/namespaces/ and remove the Namespace definition
  6. Restart CQ
  7. Email your team that you saved your Sling/CQ system from the Mayan Apocalypse