FileDocCategorySizeDatePackage
MessageDescriptor.javaAPI DocGlassfish v2 API7489Fri May 04 22:31:52 BST 2007com.sun.enterprise.deployment.runtime.common

MessageDescriptor

public class MessageDescriptor extends com.sun.enterprise.deployment.runtime.RuntimeDescriptor

Fields Summary
public static final String
JAVA_METHOD
public static final String
OPERATION_NAME
private static final String
ALL_METHODS
private String
operationName
private com.sun.enterprise.deployment.MethodDescriptor
methodDescriptor
private ArrayList
convertedMethodDescs
private com.sun.enterprise.deployment.ServiceRefPortInfo
portInfo
private com.sun.enterprise.deployment.WebServiceEndpoint
endPoint
private com.sun.enterprise.deployment.BundleDescriptor
bundleDesc
private boolean
isConverted
Constructors Summary
public MessageDescriptor()


      
Methods Summary
private voiddoStyleConversion()

        if (operationName == null && methodDescriptor == null) {
            // this is the empty message case
            // and we need to expand to all methods 
            convertedMethodDescs =  getAllSEIMethodsOf(ALL_METHODS);
        } else if (methodDescriptor != null) {
            if (methodDescriptor.getName() != null  &&
                methodDescriptor.getParameterClassNames() != null) {
                // this is the exact case, so no conversion needed
                convertedMethodDescs.add(methodDescriptor);
            } else if (methodDescriptor.getName() != null  &&
                methodDescriptor.getParameterClassNames() == null) { 
                // we need to check for overloading methods
                convertedMethodDescs = 
                    getAllSEIMethodsOf(methodDescriptor.getName());
            }
        }
        isConverted = true;
    
public java.util.ArrayListgetAllDefinedMethodsInMessage()
Return all methods defined in this message. In the case of an empty message, it will return all methods defined in the SEI. In the case of methods overloading, it will return all methods defined in the SEI that match with the specified method name. In the case of DII, i.e the client doesn't have the SEI info, it will return an empty list for client side defined message.

       // only do the conversion if it hasn't done it yet
       if (!isConverted) {
           doStyleConversion();
       }
       return convertedMethodDescs;
    
private java.util.ArrayListgetAllSEIMethodsOf(java.lang.String methodName)

        String serviceInterfaceName = null;
        ArrayList allMethodsInSEI = new ArrayList();

        // this is a server side message
        if (endPoint != null) {
            serviceInterfaceName = endPoint.getServiceEndpointInterface();
        // this is a client side message
        } else if (portInfo != null) {
            serviceInterfaceName = portInfo.getServiceEndpointInterface();
        }
        
        // In the case of DII, client doesn't know the SEI name
        // return an empty list
        if (serviceInterfaceName == null) { 
            return allMethodsInSEI;
        }

        ClassLoader classLoader = null; 
        if (bundleDesc != null) {
            classLoader = bundleDesc.getClassLoader();
        }

        // return an empty list if class loader is not set
        if (classLoader == null) {
            return allMethodsInSEI;
        }

        try {
            Class c = classLoader.loadClass(serviceInterfaceName);
            Method[] methods = c.getMethods();
            for (int i = 0; i < methods.length; i++) {
                // empty message or message name is *
                if (methodName.equals(ALL_METHODS)) { 
                    allMethodsInSEI.add(new MethodDescriptor(methods[i]));
                // overloading methods with same method name
                } else if (methodName.equals(methods[i].getName())) {
                    allMethodsInSEI.add(new MethodDescriptor(methods[i]));
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            // if there is exception in the class loading
            // then we just return the empty list
        }
        return allMethodsInSEI;
    
public com.sun.enterprise.deployment.BundleDescriptorgetBundleDescriptor()

        return bundleDesc;
    
public com.sun.enterprise.deployment.MethodDescriptorgetMethodDescriptor()

        return methodDescriptor;
    
public java.lang.StringgetOperationName()

        return operationName;
    
public com.sun.enterprise.deployment.ServiceRefPortInfogetServiceRefPortInfo()

        return portInfo;
    
public com.sun.enterprise.deployment.WebServiceEndpointgetWebServiceEndpoint()

        return endPoint;
    
public voidsetBundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor bundleDesc)

        this.bundleDesc = bundleDesc; 
    
public voidsetMethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor methodDescriptor)

        this.methodDescriptor = methodDescriptor;
    
public voidsetOperationName(java.lang.String operationName)

        this.operationName = operationName;
    
public voidsetServiceRefPortInfo(com.sun.enterprise.deployment.ServiceRefPortInfo portInfo)

        this.portInfo = portInfo;
    
public voidsetWebServiceEndpoint(com.sun.enterprise.deployment.WebServiceEndpoint endPoint)

        this.endPoint = endPoint;