Class ShowServiceGraphConsolePlugin

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class ShowServiceGraphConsolePlugin
    extends javax.servlet.http.HttpServlet
    Plots a graph of service usages. Use as console plugin: http://localhost:9090/system/console/servicegraph. Use with graphviz tools http://graphviz.org/ e.g. with
     curl -u admin:admin 'http://localhost:9090/system/console/servicegraph.dot?classregex=%5Ecom.composum&type=dotty&bundle=true' | ccomps -x | unflatten -f -l 6 -c 3 | dot | gvpack | neato -Tpng -n2  > $TMPDIR/services.png ; open $TMPDIR/services.png
     
    See Also:
    "https://github.com/magjac/d3-graphviz", Serialized Form
    • Field Detail

      • PARAM_CLASSREGEX

        public static final String PARAM_CLASSREGEX
        A regex to limit the service classes to. Default: ^com.composum.
        See Also:
        Constant Field Values
      • PARAM_TYPE

        public static final String PARAM_TYPE
        Parameter that gives the type of the output: text or dotty / gv. Default: dotty.
        See Also:
        Constant Field Values
      • PARAM_BUNDLE

        public static final String PARAM_BUNDLE
        Parameter that determines whether we should insert the bundles as subgraphs in dotty.
        See Also:
        Constant Field Values
      • bundleContext

        protected org.osgi.framework.BundleContext bundleContext
    • Constructor Detail

      • ShowServiceGraphConsolePlugin

        public ShowServiceGraphConsolePlugin()
    • Method Detail

      • writeForm

        protected void writeForm​(PrintWriter writer,
                                 javax.servlet.http.HttpServletRequest request,
                                 String classRegex)
      • doGet

        protected void doGet​(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws javax.servlet.ServletException,
                             IOException
        Overrides:
        doGet in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • writeReferences

        protected void writeReferences​(PrintWriter writer,
                                       Map<Class<?>,​org.osgi.framework.ServiceReference<?>> classes,
                                       Pattern classPattern,
                                       boolean showBundles)
      • collectReferredClasses

        protected static void collectReferredClasses​(Type type,
                                                     List<Class> referredClasses,
                                                     Set<Type> visited)