Package com.sun.enterprise.admin.server.core

Examples of com.sun.enterprise.admin.server.core.CustomMBeanException


                names += attNames.get(i);
            }
           
            String mesg = CMBStrings.get("cmb.badAttribute", name, names);
            logger.warning(mesg);
            throw new CustomMBeanException(mesg);
        }
        return ( type );
    }
View Full Code Here


            // special case...
            if(c.equals(Character.class)){
                if(value.length() != 1){
                    String mesg = CMBStrings.get("cmb.badCharAttribute", name, value);
                    logger.warning(mesg);
                    throw new CustomMBeanException(mesg);
                }
                valueObject = Character.valueOf(value.charAt(0));
            }
            else{
                final Constructor ctor          = c.getConstructor(new Class[]{java.lang.String.class});
                valueObject                     = ctor.newInstance(params);
            }
           
        } catch (final Throwable t) {
            final String msg = CMBStrings.get("attributeValueError", name, type, value);
            throw new CustomMBeanException (msg, t);
        }
        return ( valueObject );
    }
View Full Code Here

            return info;
        }
        catch(Exception e)
        {
            throw new CustomMBeanException(e);
        }
    }
View Full Code Here

      // 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

                final Map<String, String> attributes) throws CustomMBeanException
    {
        final Map<String, String> mm = checkAndModifyParamsForName(params);
        final String name = mm.get(CustomMBeanConstants.NAME_KEY);
        if (definitionExists(name))
            throw new CustomMBeanException(CMBStrings.get("AlreadyExists",  name));
        final ObjectName onPostReg = selectObjectName(mm, attributes);
        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);
        }
        return ( mbean );
    }
View Full Code Here

            // note that onPostReg is *always* going to contain the "server" property, so we must account for that
            final ObjectName cascadedON = CustomMBeanRegistrationImpl.getCascadingAwareObjectName(onPreReg);

            // It may be setting its own name if it implements MBeanRegistration...
            if (!onPostReg.equals(cascadedON) && !selfReg) {
                throw new CustomMBeanException(CMBStrings.get("ObjectNameMismatch", onPreReg, CustomMBeanRegistrationImpl.getCascadingUnawareObjectName(onPostReg)));
            }
        }
        try {
            mv.unregisterTestMBean(onPostReg); //cleanup, if fails, could be ignored, as a new MBS is employed every time
        } catch (final Exception e) {
View Full Code Here

                }
                   
            }
            return (exists);
        } catch (final Exception e) {
            throw new CustomMBeanException(e);
        }
    }
View Full Code Here

        try {
            final File mbf      = getDefaultMBeanDirectory();
            this.url = mbf.toURL();
        } catch (final MalformedURLException m) {
            String msg = CMBStrings.get("cmb.classloader.init", m.getLocalizedMessage());
            throw new CustomMBeanException(msg, m);
        }       
    }
View Full Code Here

    }
    public ObjectName registerMBean(final Mbean mbean) throws CustomMBeanException {
        /* This is the only place where the "registration of the MBean happens.
         */
        if (mbean == null)
            throw new CustomMBeanException(CMBStrings.get("InternalError", "registerMBean() received a null argument"));
       
        ObjectName ron = null;
        try {
            logger.fine(CMBStrings.get("cmb.loadingMBean1", mbean.getName()));
            final ObjectName mon    = getCascadingAwareObjectName(mbean);
            logger.fine(CMBStrings.get("cmb.loadingMBean2", mon.toString()));
            final Class mc          = loadIt(mbean);
            final Object mo         = newIt(mc);
            ron = registerIt(mo, mon);
           
            // if the MBean implements MBeanRegistration -- it can set the ON to
            // anything at all...
            if(!ObjectNameSelectionAlgorithm.implementsMBeanRegistrationInterface(mbean.getImplClassName()))
            {
                if(!mon.equals(ron))
                    throw new CustomMBeanException(CMBStrings.get("objNameMismatch", mon, ron));
            }
            initIt(mbean, ron);
  
            // WBN 12-15-2005
            // this is just defensive programming -- the Listener should not be
            // calling us on a disabled mbean.  In the case we are being called
            // as part of pre-reg in order to get an objectname, this will make
            // one extra unneeded call to unregisterIt()
            // I say, safety first, performance second!
            if(!mbean.isEnabled())
                unregisterIt(mbean, ron);
            return ( ron );

        }catch (final CustomMBeanException cmbe) {
            if(ron != null) {
                try {
                    // paranoia...
                    unregisterIt(mbean, ron);
                }catch(Throwable t) {
                }
            }
            throw cmbe;
        }catch (final Throwable e) {
            if(ron != null) {
                try {
                    // paranoia...
                    unregisterIt(mbean, ron);
                }catch(Throwable t) {
                }
            }
            throw new CustomMBeanException(e);
        }
    }
View Full Code Here

            final ObjectName configON   = new ObjectName(mbean.getObjectName());
            return (getCascadingAwareObjectName(configON) );
        } catch(final CustomMBeanException cmbe) {
            throw cmbe;
        } catch(final Exception e) {
            throw new CustomMBeanException(e);
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.admin.server.core.CustomMBeanException

Copyright © 2018 www.massapicom. 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.