Examples of Mbean


Examples of com.sun.enterprise.config.serverbeans.Mbean

       
            //should have obtained the app reference, if all well
            if (appRef != null) {
                //check there exists a definition
                Applications apps = domain.getApplications();
                Mbean definedMBean = apps.getMbeanByName(actionMBeanName);
                if (definedMBean == null ) {
                    appRef = null;
                }
            }
        } catch (ConfigException ex) {
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.Mbean

          ApplicationRef appRef = verifyActionMBean(actionMBeanName, domain, ctxToUse);


          if (appRef != null) {
              Applications apps = domain.getApplications();
              Mbean definedMBean = apps.getMbeanByName(actionMBeanName);


              if (appRef.isEnabled() && definedMBean.isEnabled() ) {
                  if ((definedMBean.getObjectType()).equals(USER_DEFINED_TYPE)) {
                      actionObjName = registerAction(ruleEvent,actionMBeanName,
                                                     definedMBean,false,null);
                  } else {
                      // system defined, need to explictly load
                      actionObjName = registerAction(ruleEvent,actionMBeanName,
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.Mbean

            // create some unique names...
            final String oname = "user:getMBeanInfo=" + System.nanoTime();  
            final String name = "getMBeanInfo" + System.nanoTime();  

            // create an MBean object because our helper code uses them...
            Mbean mbean = new Mbean();
            mbean.setImplClassName(classname);
            mbean.setName(name);
            mbean.setObjectName(oname);
            mbean.setEnabled(true);

            // fetch the MBeanServer
            final MBeanServer mbs = MBeanServerFactory.getMBeanServer();

            // Create a helper to do the reg/unreg...
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.Mbean

     * @param params a Map<String, String> specifying the other parameters optionally needed for mbean
     * @param attributes a Map<String, String> specifying the custom MBean initialization attributes
     */
    protected String createMBeanDefinitionAddingReferenceToServer(final String s, final Map<String, String> params, final Map<String, String> attributes) throws CustomMBeanException {
        try {
            final Mbean mbean = this.createMBeanDefinitionInDomain(params,  attributes);
            final ObjectName onPostReg = new ObjectName(mbean.getObjectName());

      // bug 6308668
      // the mbean was created but never deleted IN THE CONTEXT
      if (onExists(s, onPostReg))  //use references here, because object-name is NOT a primary key unlike name
      {
        ServerBeansFactory.removeMbeanDefinition(acc, mbean.getName());
 
                throw new CustomMBeanException(CMBStrings.get("AlreadyExists",  onPostReg.toString()));
      }
            ServerBeansFactory.addMbeanReference(this.acc, mbean.getName(), s);
            return ( mbean.getName() );
        } catch (final Exception e) {
            throw new CustomMBeanException(e);
        }
    }
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.Mbean

        if (!CustomMBeanConstants.CUSTOM_MBEAN_DOMAIN.equals(onPostReg.getDomain())) {
                throw new IllegalArgumentException (CMBStrings.get("BadDomainName", onPostReg.getDomain(), CustomMBeanConstants.CUSTOM_MBEAN_DOMAIN));
        }
        // Now we mutate the params with "final" valid values
        mm.put(CustomMBeanConstants.OBJECT_NAME_KEY, onPostReg.toString()); //put the correct object-name to map
        final Mbean mbean = MBeanValidator.toMbean(mm, attributes, true);
        try {
            ServerBeansFactory.addMbeanDefinition(this.acc, mbean);
        } catch (final Exception e) {
            throw new CustomMBeanException(e);
        }
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.Mbean

        mbs = MBeanServerFactory.newMBeanServer();
    }
    public ObjectName registerTestMBean(final Map<String, String> params, final Map<String, String> attributes) throws RuntimeException {
        try {
            CustomMBeanRegistration cmr = new CustomMBeanRegistrationImpl(mbs);
            final Mbean m = toMbean(params, attributes, true);
            final ObjectName ron = cmr.registerMBean(m);
            return ( ron );
        } catch (final Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.Mbean

     * @param params a Map consisting of name, class-name, object-name etc. of the Mbean
     * @param attributes a Map consisting of name and value of the MBean attribute which will be added as <property> sub-elements in <mbean>.
     * @param enabledNotUsed a vestigial parameter.  <b>This parameter has no effect</b> It is still here because this is a public method that may have callers anywhere at all.
     */
    public static final Mbean toMbean(final Map<String, String> params, final Map<String, String> attributes, final boolean enabledNotUsed) {
        final Mbean cmb             = new Mbean();
        final String name           = params.get(CustomMBeanConstants.NAME_KEY);
        final String cName          = params.get(CustomMBeanConstants.IMPL_CLASS_NAME_KEY);
        final String on             = params.get(CustomMBeanConstants.OBJECT_NAME_KEY);
        final String ot             = params.get(CustomMBeanConstants.OBJECT_TYPE_KEY);
        final String enabledString  = params.get(CustomMBeanConstants.ENABLED_KEY);
       
        boolean enabled = true;
       
        if(enabledString != null)
            enabled = Boolean.valueOf(enabledString);

        cmb.setName(name);
        cmb.setImplClassName(cName);
        cmb.setObjectName(on);
        cmb.setObjectType(ot);
        cmb.setEnabled(enabled);
        cmb.setElementProperty(map2Properties(attributes));
        return ( cmb );
    }
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.Mbean

                    Object co = rcc.exactLookup(xp);
                    if (co instanceof ApplicationRef) {
                        co = ApplicationHelper.findApplication(rcc,
                                ((ApplicationRef)co).getRef());
                        if (co instanceof Mbean) {
                            Mbean mb = (Mbean)co;
                            if(mb.isEnabled())
                                register(mb);
                        }
                    }
                }
            }
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.Mbean

                    Object co = occ.exactLookup(xp);
                    if (co instanceof ApplicationRef) {
                        co = ApplicationHelper.findApplication(occ,
                                ((ApplicationRef)co).getRef());
                        if (co instanceof Mbean) {
                            final Mbean mbean = (Mbean)co;
                            unregister(mbean);
                            logger.info(CMBStrings.get("cmb.successfulDelete", mbean.getName()));
                        }
                    }
                }
            }
        } catch (final Exception e) {
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.Mbean

    private void handleUpdate(Mbean mbean){
        logger.info(CMBStrings.get("cmb.illegalHandleUpdate", mbean.getName()));
    }

    private void handleUpdate(Object parent, ElementProperty ep) throws JMException, CustomMBeanException{
        final Mbean mbean               = (Mbean) parent;
        if (! mbean.isEnabled()) {
            logger.info(CMBStrings.get("cmb.mbeanIsDisabled", mbean.getName()));
            return;
        }
        final ObjectName on = CustomMBeanRegistrationImpl.getCascadingAwareObjectName(mbean);
        final MBeanAttributeSetter mas  = new MBeanAttributeSetter(mbs, on);
        mas.setIt(ep.getName(), ep.getValue());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.