1 2 Previous Next 18 Replies Latest reply on Oct 17, 2008 10:08 AM by Scott Stark

    JSR77 View

    Dimitris Andreadis Master

      We need to specify what's needed to implement the remain bits of the JSR77 view, so the work can be broken out, if possible:

      https://jira.jboss.org/jira/browse/JBAS-5545

        • 1. Re: JSR77 View
          Scott Stark Master

          Its the tree of mbeans found in the jbossas/management project in the org.jboss.management.j2ee package. We had discussed making this part of the management interface by adding support for the location of the ManagedDeployment/ManagedComponent in the jsr77 mbean namespace so that the jsr77 view was just a derivative of the profile service mangement view.

          That requires:
          - Updating jboss-managed to have an additional jsr77 name component.
          - Getting management annotation on all ear/ejb/war/car/rar deployer metadata
          - Create a JSR77Deployer that outputs the ServiceMetaData for the jsr77 mbeans.

          If we just want to get the basic jsr77 mbean structure that shows the component names, the JSR77Deployer could just be written to map a deployment attachment type to a jsr77 mbean from the org.jboss.management.j2ee package creating the name from the deployment metadata.

          • 2. Re: JSR77 View
            Ales Justin Master

            Anybody done anything in this area?

            Otherwise I'll have a go, starting from tomorrow.
            Trying to mimic the old LocalJBossServerDomain in more generic+MC fashion.

            Scott, if you have some more info/instructions, I'm all ears. :-)

            • 3. Re: JSR77 View
              Scott Stark Master

              No, I'm working on other things right now. The best starting point is the jsr77 spec, and then look at our concrete mbean implementations in the jbossas/managed project. The spec is available from:
              http://jcp.org/aboutJava/communityprocess/mrel/jsr077/index.html

              The first issue will be that the jsr77 mbeans try to wrap the component mbeans. This will no longer be valid in general. We just need to make the jsr77 mbeans standalone, shallow representations of the javaee structure. We can worry about adding support for the optional statistics and other information down the road.

              • 4. Re: JSR77 View
                Adrian Brock Master

                 

                "alesj" wrote:

                Otherwise I'll have a go, starting from tomorrow.
                Trying to mimic the old LocalJBossServerDomain in more generic+MC fashion.


                I wouldn't go for a full rewrite now, that would be a lot more work.

                A simpler solution would be to look at
                org.jboss.management.j2ee.*
                in the management project.

                These are basically just mbeans that need to be created along with the
                relevant component.

                So you could for example have an EJBJSR77Deployer that looks at the
                ejb metadata and then either creates the ServiceMetaData for the relevant
                jsr77 mbean(s) or talks to the LocalJBossServerDomain directly.

                The same would go for the other types.

                See LocalJBossServerDomain which previously worked by listening to
                the old deployers and then did a type->factory thing in handleNotification().

                • 5. Re: JSR77 View
                  Adrian Brock Master

                   

                  "adrian@jboss.org" wrote:
                  "alesj" wrote:

                  Otherwise I'll have a go, starting from tomorrow.
                  Trying to mimic the old LocalJBossServerDomain in more generic+MC fashion.


                  I wouldn't go for a full rewrite now, that would be a lot more work.


                  The full rewrite would be to have some link between the ManagedObject
                  and the jsr77 mbean. i.e. When I only have to define my managed operataions
                  and stats once.

                  The trigger would be some "annotation" or something in the ManagedObject that says
                  what the jsr77 name is which would also act as a trigger
                  for it going into the jsr77 view.

                  • 6. Re: JSR77 View
                    Adrian Brock Master

                     

                    "adrian@jboss.org" wrote:

                    These are basically just mbeans that need to be created along with the
                    relevant component.


                    We have to keep the old mbeans since that is what the client api uses and assumes.
                    A full rewrite could make the client api run over the profile service which
                    would be a better integration point. i.e. jsr77 would just be a facade over the managed
                    objects.

                    • 7. Re: JSR77 View
                      Ales Justin Master

                       

                      "adrian@jboss.org" wrote:

                      So you could for example have an EJBJSR77Deployer that looks at the
                      ejb metadata and then either creates the ServiceMetaData for the relevant
                      jsr77 mbean(s) or talks to the LocalJBossServerDomain directly.

                      How do I know what all is ejb metadata?
                      Looking at the JBossMetaData attachment?
                       public org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData getEnterpriseBeans() { /* compiled code */ }
                      
                       public org.jboss.metadata.ejb.jboss.WebservicesMetaData getWebservices() { /* compiled code */ }
                      
                       public org.jboss.metadata.ejb.jboss.ResourceManagersMetaData getResourceManagers() { /* compiled code */ }
                      

                      Checking all of these, or just enterprise beans?

                      But even better question is how to collect all the metadata for JCA / RAR.
                      Just looking at the jca-deployers-jboss-beans.xml gives me shivers. :-)

                      • 8. Re: JSR77 View
                        Scott Stark Master

                        These are the attachment types:

                        EJB = JBossMetaData attachment
                        CAR = JBossClientMetaData attachment
                        EAR = JBossAppMetaData attachment
                        WAR = JBossWebMetaData attachment
                        RAR = RARDeploymentMetaData attachment
                        JCA = ManagedConnectionFactoryDeploymentGroup attachment
                        JMS = ServiceMetaData attachment with a code value of either org.jboss.jms.server.destination.QueueService org.jboss.jms.server.destination.TopicService

                        • 9. Re: JSR77 View
                          Ales Justin Master

                           

                          "scott.stark@jboss.org" wrote:

                          WAR = JBossWebMetaData attachment

                          As I want to make as little change / code as possible
                          I'm trying to use old code as much as I can.

                          But it looks like I'm gonna be stuck as I have hard time getting
                          ObjecName(s) from metadata.

                          This is how my effort to port WebModule jsr77 handling looks like:
                          public class WebModuleJSR277Deployer extends AbstractVFSJSR277Deployer<JBossWebMetaData>
                          {
                           public WebModuleJSR277Deployer()
                           {
                           super(JBossWebMetaData.class);
                           }
                          
                           protected void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossWebMetaData metaData) throws Throwable
                           {
                           String warName = unit.getSimpleName();
                           ObjectName webModuleService = null; // TODO
                           String earName = FactoryUtils.findEarParent(unit);
                           ObjectName jsr77Name = WebModule.create(server, earName, warName, unit.getRoot().toURL(), webModuleService);
                           putObjectName(unit, WebModule.class.getName(), jsr77Name);
                           Iterable<ObjectName> servlets = null; // TODO
                           for (ObjectName servletName : servlets)
                           {
                           try
                           {
                           createServlet(server, unit, jsr77Name, servletName);
                           }
                           catch (Throwable e)
                           {
                           log.debug("Failed to create JSR-77 servlet: " + servletName, e);
                           }
                           }
                           }
                          
                           protected void undeployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossWebMetaData metaData)
                           {
                           ObjectName jsr77Name = getObjectName(unit, WebModule.class.getName());
                           log.debug("Destroy module: " + jsr77Name);
                           Iterable<ObjectName> servlets = null; // TODO
                           for (ObjectName servletName : servlets)
                           {
                           try
                           {
                           destroyServlet(server, unit, servletName);
                           }
                           catch (Throwable e)
                           {
                           log.debug("Failed to destroy JSR-77 servlet: " + servletName, e);
                           }
                           }
                          
                           if (jsr77Name != null)
                           {
                           WebModule.destroy(server, jsr77Name);
                           }
                           }
                          
                           /**
                           * Create JSR-77 Servlet
                           *
                           * @param mbeanServer the MBeanServer context
                           * @param unit the deployment unit
                           * @param webModuleName the JSR77 name of the servlet's WebModule
                           * @param servletServiceName The jboss servlet mbean name
                           * @return servlet's jsr77 object name
                           */
                           public ObjectName createServlet(MBeanServer mbeanServer, VFSDeploymentUnit unit, ObjectName webModuleName, ObjectName servletServiceName)
                           {
                           ObjectName jsr77Name = null;
                           // We don't currently have a web container mbean
                           ObjectName webContainerName = null;
                           try
                           {
                           log.debug("Creating servlet: " + servletServiceName);
                           String servletName = servletServiceName.getKeyProperty("name");
                           if (servletName != null)
                           {
                           // Only treat resources with names as potential servlets
                           jsr77Name = Servlet.create(mbeanServer, webModuleName, webContainerName, servletServiceName);
                           putObjectName(unit, servletServiceName.getCanonicalName(), jsr77Name);
                           log.debug("Created servlet: " + servletServiceName + ", module: " + jsr77Name);
                           }
                           }
                           catch (Exception e)
                           {
                           log.debug("Failed to create servlet: " + servletServiceName, e);
                           }
                          
                           return jsr77Name;
                           }
                          
                           /**
                           * Destroy JSR-77 Servlet
                           *
                           * @param server the MBeanServer context
                           * @param unit the deployment unit
                           * @param servletServiceName The jboss servlet mbean name
                           */
                           public void destroyServlet(MBeanServer server, VFSDeploymentUnit unit, ObjectName servletServiceName)
                           {
                           ObjectName jsr77Name = getObjectName(unit, servletServiceName.getCanonicalName());
                           log.debug("Destroy container: " + servletServiceName + ", module: " + jsr77Name);
                           if (jsr77Name != null)
                           {
                           Servlet.destroy(server, jsr77Name);
                           }
                           }
                          }
                          


                          It's the TODOs that I don't know how to get / create.
                          And I guess I'm gonna face the same problems in EJB, JCA, RAR, ...

                          Perhaps in this case I could even get WebModule ObjectName.
                          From (making it static) AbstractWarDeployer::getObjectName(JBossWebMetaData).
                          But then in TomcatDeployment, we create another ObjectName,
                          and set it to WebApplication instance (WebApplication::setAppData).
                          Which one is it? ;-)

                          Or is my approach with deployers + metadata completely wrong? :-)

                          • 10. Re: JSR77 View
                            Ales Justin Master

                            I see LocalJBossServerDomain is completely removed from any build.

                            Should I reinstate it when I'm done with my port.
                            Or should I just port the pieces that are required, but make it POJO + @JMX?

                            • 11. Re: JSR77 View
                              Scott Stark Master

                              I just removed it with the conf/jboss-service.xml refactoring since it was not doing anything useful. Restore it as you need, should just be a pojo + its jmx registration as the J2EEDomain.

                              • 12. Re: JSR77 View
                                Scott Stark Master

                                 

                                "alesj" wrote:

                                ...
                                It's the TODOs that I don't know how to get / create.
                                And I guess I'm gonna face the same problems in EJB, JCA, RAR, ...

                                Perhaps in this case I could even get WebModule ObjectName.
                                From (making it static) AbstractWarDeployer::getObjectName(JBossWebMetaData).
                                But then in TomcatDeployment, we create another ObjectName,
                                and set it to WebApplication instance (WebApplication::setAppData).
                                Which one is it? ;-)

                                Or is my approach with deployers + metadata completely wrong? :-)

                                I think its wrong in that there is no point in hooking to the actual components for the first iteration. Just create the jsr77 namespace without stats, operations, and we'll correctly produce the mbeans from the management view later.



                                • 13. Re: JSR77 View
                                  Ales Justin Master

                                   

                                  "scott.stark@jboss.org" wrote:

                                  I think its wrong in that there is no point in hooking to the actual components for the first iteration. Just create the jsr77 namespace without stats, operations, and we'll correctly produce the mbeans from the management view later.

                                  What do you mean under jsr77 namespace?

                                  How do you plan on getting the mbean names?
                                  Changing the way we/I do it currently (see my code snippet) - going off the deployers?

                                  • 14. Re: JSR77 View
                                    Scott Stark Master

                                    By just generating the names off of the deployment names, and metadata. It does not need to match or be derived from any mbeans that may be generated by the deployers. There are 3 parts to the jsr77 namespace:
                                    - hierarchy - that should be known from the deployment + the top level domain
                                    - module type - known from the metadata
                                    - component type - known from the metadata

                                    1 2 Previous Next