The source of the problem is management setup such as this from
SARDeployer where over 60% of the code is JSR77 setup with
implicit dependencies on the org.jboss.management.* pkgs that
if it fails, prevents the service from being created. Why can't these
steps be performed based on an event generated from here rather
than embedding all of this here? Its not a question of breaking this
code now, its maintainability and mixing of functionality.

   public void create(DeploymentInfo di)
      throws DeploymentException
   {
      try
      {
         // install the MBeans in this descriptor
         log.debug("Deploying SAR, create step: url " + di.url);

         // Register the SAR UCL as an mbean so we can use it as the service
loader
         ObjectName uclName = di.ucl.getObjectName();
         log.debug("Registering service UCL="+uclName);
         getServer().registerMBean(di.ucl, uclName);

         // Create JSR-77 SAR-Module
         String lURL = di.url.toString();
         int lIndex = lURL.lastIndexOf( "/" );
         String lName = lURL.substring( lIndex >= 0 ? lIndex + 1 : 0 );
         // This is to go around the project dependencies
         Class lServiceModule = Class.forName(
"org.jboss.management.j2ee.ServiceModule" );
         Method lCreateSAR = lServiceModule.getMethod(
            "create",
            new Class[] {
               MBeanServer.class,
               String.class,
               URL.class
            }
         );
         ObjectName lSARName = (ObjectName) lCreateSAR.invoke(
            null,
            new Object[] {
               server,
               lName,
               di.localUrl
            }
         );
         log.info( "Created ServiceModule: " + lSARName );

         List mbeans = di.mbeans;
         mbeans.clear();
         List descriptorMbeans =
serviceController.install(di.document.getDocumentElement(), uclName);
         mbeans.addAll(descriptorMbeans);

         // create the services
         for (Iterator iter = di.mbeans.iterator(); iter.hasNext(); )
         {
            ObjectName service = (ObjectName)iter.next();

            // The service won't be created until explicitly dependent
mbeans are created
            serviceController.create(service);
         }
         // This is to go around the project dependencies
         Class lMBean = Class.forName( "org.jboss.management.j2ee.MBean" );
         Method lCreate = lMBean.getMethod(
            "create",
            new Class[] {
               MBeanServer.class,
               String.class,
               String.class,
               ObjectName.class
            }
         );
         ObjectName[] lNames = (ObjectName[]) mbeans.toArray( new
ObjectName[ 0] );
         for( int i = 0; i < lNames.length; i++ ) {
            // If ServiceModule is not created yet, do it now
            if( lSARName == null ) {
               lSARName = (ObjectName) lCreateSAR.invoke(
                  null,
                  new Object[] {
                     server,
                     lName,
                     di.localUrl
                  }
               );
               log.info( "Created ServiceModule: " + lSARName );
            }
            // Create JSR-77 MBean
            log.info( "Create MBean, name: " + lNames[ i ] + ", SAR Module:
" +lSARName );
            lCreate.invoke(
               null,
               new Object[] {
                  server,
                  lNames[ i ] + "",
                  lSARName == null ? null : lSARName + "",
                  lNames[ i ]
               }
            );
         }

      }
      catch (Exception e)
      {
         destroy(di);
         throw new DeploymentException("create operation failed for package
"
            + di.url, e);
      }
   }

xxxxxxxxxxxxxxxxxxxxxxxx
Scott Stark
Chief Technology Officer
JBoss Group, LLC
xxxxxxxxxxxxxxxxxxxxxxxx
----- Original Message -----
From: "Andreas Schaefer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Scott M Stark"
<[EMAIL PROTECTED]>
Sent: Friday, May 24, 2002 2:23 PM
Subject: Re: [JBoss-dev] How about integrating JSR77 via notifications


> I don't think this is possible. We are already listening to JMX events
> to determine the state of a component. But this is only the easy part
> of JSR-77. Even thought that JSR-77 spec. does not really cover
> what it was supposed to do the main part currenlty is to retrieve
> and calculate performance statstics. The rest is just to provide a
> JSR-77 compliant view to an application server.
>
> BTW I am not aware that JSR-77 breaks existing code. Mostely
> it was the other way around that changes where made and the
> JSR-77 stuff was left out and broke.
> The design is made that the invasive part is as small as possible.
>
> So what is the source of the problem ?
>
> Have fun - Andy
>



_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to