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

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


                // this may throw a ConfigException if the cluster config is corrupt.  If that happens it will
                // be processed by the catch(Exception e) below.
                // Conversely, if the ref already exists in the cluster than we don't want to go into
                // that catch clause (the mbean is SUPPOSED to stay registered) -- and we don't!
                if(ServerBeansFactory.isReferencedMBeanInCluster(this.acc, newTarget, name))
                    throw new CustomMBeanException(CMBStrings.get("cmb.ee.local.MbeanAlreadyExistsInCluster", name, newTarget));
               
                this.createMBeanReferencesInCluster(newTarget, name);
            }
            else {
                throw new RuntimeException(CMBStrings.get("cmb.ee.local.targetProcessBad", target));
            }
            return ( name );
        } catch (final CustomMBeanException cmbe) {
            throw cmbe;
        }
        catch (final Exception e) {
            //protect against the case where the definition was created, but reference creation failed
            if (mbeanDefinitionCreated) {
                try {
                    ServerBeansFactory.removeMbeanDefinition(this.acc, params.get(CustomMBeanConstants.NAME_KEY));
                } catch (final Exception ee) {throw new RuntimeException(ee); }
            }
            throw new CustomMBeanException(e);
        }
    }
View Full Code Here


            else {
                throw new RuntimeException(CMBStrings.get("cmb.ee.local.targetProcessBad", target));
            }
            return ( name );
        } catch (final Exception e) {
            throw new CustomMBeanException(e);
        }
    }
View Full Code Here

        if (ServerBeansFactory.isReferencedMBean(this.acc, sName, name)) {
            ServerBeansFactory.removeMbeanReference(this.acc, name, sName);
        }
        else {
            final String msg = CMBStrings.get("cmb.ee.local.notReferenced", name, sName);
            throw new CustomMBeanException(msg);
        }
        //now delete the mbean definition itself, it there are no more references
        deleteMBeanDefinitionIfNoMoreReferences(name);
    }
View Full Code Here

    private void createMBeanReferenceForServer(final String target, final String ref) throws Exception {
        Mbean m = null;
        m = ServerBeansFactory.getMBeanDefinition(this.acc, ref);
        if (m == null) {
            final String msg = CMBStrings.get("cmb.ee.local.mustCreateDefinition", ref);
            throw new CustomMBeanException(msg);
        }
        if (! ServerBeansFactory.isReferencedMBean(this.acc, target, ref) ) {
            ServerBeansFactory.addMbeanReference(this.acc, ref, target);
        }
        else {
            final String msg = CMBStrings.get("cmb.ee.local.refExists", target, ref);
            throw new CustomMBeanException(msg);
        }
    }
View Full Code Here

        List<ObjectName> ons = null;
        Target t = null;
        try {
            t = TargetBuilder.INSTANCE.createTarget(target, vTargets, target, this.acc);
        } catch(ConfigException e) {
            throw new CustomMBeanException(e);
        }
        if (TargetType.DAS.equals(t.getType()) || TargetType.SERVER.equals(t.getType())) {
            if (TargetType.SERVER.equals(t.getType())) {
                EnterpriseCustomMBeanOperations.checkClusteredInstance(this.acc, t.getName());
            }
            ons = super.listMBeanConfigObjectNamesForServer(t.getName());
        }
        else if (TargetType.DOMAIN.equals(t.getType())) {
            // just list the mbean definitions
            ons = this.getMBeanDefinitionObjectNamesInDomain();
        }
        else {//has to be a cluster
            String nameOfAServerInCluster = null;
            try {
                Server[] servers= ServerHelper.getServersInCluster(this.acc, target);
                nameOfAServerInCluster = servers[0].getName();
                ons = super.listMBeanConfigObjectNamesForServer(nameOfAServerInCluster);
            } catch(ConfigException e) {
                throw new CustomMBeanException(e);
            }
        }
        return ( ons ) ;
    }
View Full Code Here

    private List<ObjectName> getMBeanDefinitionObjectNamesInDomain() throws CustomMBeanException {
        try {
            final List<Mbean> mbeans = ServerBeansFactory.getAllMBeanDefinitions(this.acc);
            return ( super.mbeans2ConfigMBeanObjectNames(mbeans) );
        } catch (final Exception e) {
            throw new CustomMBeanException(e);
        }
    }
View Full Code Here

    public boolean isMBeanEnabled(String target, String name) throws CustomMBeanException {
        boolean enabled = false;
        if (!existsMBean(target, name)) {
            final String msg = CMBStrings.get("MBeanNotFound", name, target);
            throw new CustomMBeanException(msg);
        }
        final List<ObjectName> ons      = this.listMBeanConfigObjectNames(target);
        //get the attribute called "enabled" on these ObjectNames.
        try {
            final MBeanServerConnection mbsc        = MBeanServerFactory.getMBeanServer(); // best to be prepared toward remoteness
            final String noe                        = ServerTags.ENABLED;
            for (ObjectName on : ons) {
                final String s = (String) mbsc.getAttribute(on, noe);
                if (Boolean.valueOf(s).booleanValue()) {
                    enabled = true;
                    break;
                }
            }
            return ( enabled );
        } catch (final Exception e) {
            throw new CustomMBeanException (e);
        }
    }
View Full Code Here

    public List<ObjectName> listMBeanConfigObjectNames(String target) throws CustomMBeanException {
        Target t = null;
        try {
            t = TargetBuilder.INSTANCE.createTarget(target, this.acc);
        } catch (final Exception e) {
            throw new CustomMBeanException(e);
        }
        return ( this.listMBeanConfigObjectNamesForServer(t.getName()) );
    }
View Full Code Here

                final String voa                        = (String) mbsc.getAttribute(on, noa);
                names.add(voa);
            }
            return ( names );
        } catch(final Exception e) {
            throw new CustomMBeanException(e);
        }
    }
View Full Code Here

        {
            throw cmbe;
        }
        catch(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.