FileDocCategorySizeDatePackage
JndiMBeanImpl.javaAPI DocGlassfish v2 API8281Fri May 04 22:24:20 BST 2007com.sun.enterprise.admin.monitor.jndi

JndiMBeanImpl

public class JndiMBeanImpl extends Object implements JndiMBean
The JndiMBean implementation from which a client can access jndi entries given a particular context.
author
Rob Ruyak

Fields Summary
private JndiMBeanHelper
helper
MBeanInfo
mbeanInfo
private static final Logger
logger
private static final com.sun.enterprise.util.i18n.StringManager
sm
Constructors Summary
public JndiMBeanImpl()
Creates a new instance of JndiMBeanImpl

    
           
      
        initialize();
    
Methods Summary
javax.management.MBeanOperationInfocreateOperationInfo(java.lang.reflect.Method method)

        return new MBeanOperationInfo(method.getName(), 
            "Method " + method.getName(),
            getParameterInfo(method.getParameterTypes()),
            method.getReturnType().getName(), 
            MBeanOperationInfo.INFO);        
    
public java.lang.ObjectgetAttribute(java.lang.String str)

        throw new UnsupportedOperationException(
                sm.getString("monitor.jndi.unsupported_method"));
    
public javax.management.AttributeListgetAttributes(java.lang.String[] str)

        throw new UnsupportedOperationException(
                sm.getString("monitor.jndi.unsupported_method"));
    
public javax.management.MBeanInfogetMBeanInfo()

        if(mbeanInfo == null) {
            mbeanInfo = new MBeanInfo(this.getClass().getName(),
                "Managed Object for " + this.getClass().getName(), 
                null, null, getOperationInfo(), null);
        } 
        return mbeanInfo;
    
public java.util.ArrayListgetNames(java.lang.String context)
Gets all the jndi entry names given a specific context name. This method uses the JndiMBeanHelper object to execute all logic involved in querying entries via jndi to the application server's naming service.

param
context The context name under which the names reside.
return
An array of {@link NameClassPair} objects representing the jndi entries.
throws
{@link MBeanException} if there is an error getting the entries.
see
JndiMBeanHelper#getJndiEntriesByContextPath(String)

        java.util.ArrayList names = null;
        names = helper.getJndiEntriesByContextPath(context);
        return names;
    
javax.management.MBeanOperationInfo[]getOperationInfo()

        Method[] methods = this.getClass().getMethods();
        MBeanOperationInfo[] mInfo = new MBeanOperationInfo[methods.length];
        for(int i= 0; i < methods.length; i++){
           mInfo[i]= createOperationInfo(methods[i]);                     
        }
        return mInfo;
    
javax.management.MBeanParameterInfo[]getParameterInfo(java.lang.Class[] paramTypes)

 
        MBeanParameterInfo[] params=null;
        if(paramTypes != null){
            params = new MBeanParameterInfo[paramTypes.length];
            for(int i = 0; i < paramTypes.length; i++){
                try {
                    params[i] = new MBeanParameterInfo("param" + i,
                                paramTypes[i].getName(),
                                paramTypes[i].getName());
                } catch(java.lang.IllegalArgumentException e){
                    logger.log(Level.INFO, e.toString());                                    
                }
            }
        }
        return params;
    
voidinitialize()
Initializes the JndiMBeanImpl mbean object for servicing queries related to the jndi entries of the application server's naming service. This initialization involves the creation of the object's JndiMBeanHelper for delegating requests.

        helper = new JndiMBeanHelper();
    
public java.lang.Objectinvoke(java.lang.String str, java.lang.Object[] obj, java.lang.String[] str2)

        Object a = null;
        Class[] c = new Class[str2.length];
        for(int i=0; i < str2.length; i++){
            c[i] = str2[i].getClass();
        }
        try {
           a = (Object)this.getClass().getMethod(str, c).invoke(this, obj);
        } catch(InvocationTargetException e){
            logger.log(Level.INFO,e.getMessage(), e);
            MBeanException me = 
                new MBeanException((Exception)e.getTargetException());
            throw me;
        } catch (Exception e) {
            throw new MBeanException(e);
        }
        return a;
    
booleanisAttrGetterOrSetter(java.lang.reflect.Method operation)

        if(operation.getName().startsWith("get") 
            || operation.getName().startsWith("set")){
            return true;
        }
        return false;
    
public voidsetAttribute(javax.management.Attribute attribute)

        throw new UnsupportedOperationException(
                sm.getString("monitor.jndi.unsupported_method"));
    
public javax.management.AttributeListsetAttributes(javax.management.AttributeList attributeList)

        throw new UnsupportedOperationException(
                sm.getString("monitor.jndi.unsupported_method"));