FileDocCategorySizeDatePackage
MBeanHelper.javaAPI DocGlassfish v2 API6475Fri May 04 22:30:24 BST 2007com.sun.enterprise.jbi.serviceengine.install

MBeanHelper

public class MBeanHelper extends Object
author
Manisha Umbarje

Fields Summary
private static final String
OBJ_NAME_PREFIX
private static final String
SERVICE_NAME
private static final String
CONTROL_TYPE
private static final String
COMPONENT_TYPE
private static final String
ADMIN_SERVICE_CONTROL_TYPE
public static final String
INSTALLATION_SERVICE
public static final String
ADMIN_SERVICE
public static final String
CONFIGURATION_SERVICE
public static final String
FRAMEWORK
public static final String
ESB_INSTALLATION_SERVICE
public static final String
ESB_LIFECYCLE_SERVICE
private MBeanServerConnection
mbeanServer
Constructors Summary
public MBeanHelper(MBeanServerConnection mbeanServer)
Creates a new instance of ObjectNames

    
           
       
        this.mbeanServer = mbeanServer;
    
Methods Summary
public javax.management.ObjectNamegetObjectName(java.lang.String domainName, java.lang.String serviceName)

        if(serviceName != null && domainName != null) {
            String objName = OBJ_NAME_PREFIX + domainName + SERVICE_NAME;
            String controlType = "";
            if(serviceName.equals(INSTALLATION_SERVICE)) {
                controlType = serviceName;
            } else if(serviceName.equals(ADMIN_SERVICE)) {
                controlType = ADMIN_SERVICE_CONTROL_TYPE;
            } else if(serviceName.equals(FRAMEWORK)) {
                controlType = CONFIGURATION_SERVICE;
            }
            objName = objName + serviceName + CONTROL_TYPE +
                    controlType + COMPONENT_TYPE;
            return getObjectName(objName);
        }
        throw new ServiceEngineException("Either JBI Instance name or Service name or both null");
    
public javax.management.ObjectNamegetObjectName(java.lang.String stringifiedObjName)

        
        if(stringifiedObjName != null) {
            try {
                ObjectInstance objInstance =
                        mbeanServer.getObjectInstance(new ObjectName(stringifiedObjName));
                return objInstance.getObjectName();
            } catch(MalformedObjectNameException e) {
                throw new ServiceEngineException(e.getMessage());
            } catch(InstanceNotFoundException infe) {
                throw new ServiceEngineException(infe.getMessage());
            } catch(IOException ioe) {
                throw new ServiceEngineException(ioe.getMessage());
            }
        } else
            throw new ServiceEngineException(" Null object name");
        
    
public java.lang.ObjectinvokeMBeanOperation(javax.management.ObjectName objName, java.lang.String operationName, java.lang.Object[] params, java.lang.String[] signature)

        Object result = null;
        
        try {
            result = mbeanServer.invoke(objName,operationName,
                    params, signature);
        } catch (InstanceNotFoundException notFoundEx) {
            throw new ServiceEngineException(notFoundEx);
        } catch ( ReflectionException rEx){
            throw new ServiceEngineException(rEx);
        } catch ( MBeanException mbeanEx ) {
            throw ServiceEngineException.filterExceptions(mbeanEx);
        } catch (RuntimeMBeanException rtEx){
            throw ServiceEngineException.filterExceptions(rtEx);
        } catch (RuntimeOperationsException rtOpEx){
            throw ServiceEngineException.filterExceptions(rtOpEx);
        } catch (Exception ex ) {
            throw ServiceEngineException.filterExceptions(ex);
        }
        
        return result;