Search in sources :

Example 71 with MethodDescriptor

use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.

the class PersistenceDescriptor method initializeAllQueriedMethods.

private void initializeAllQueriedMethods() {
    allQueriedMethods = new HashSet();
    // add all ejbSelect* methods in persistentClass
    Method[] beanMethods = getPersistentClass().getMethods();
    for (int i = 0; i < beanMethods.length; i++) {
        if (beanMethods[i].getName().startsWith("ejbSelect")) {
            allQueriedMethods.add(new MethodDescriptor(beanMethods[i], MethodDescriptor.EJB_BEAN));
        }
    }
    // add all finders in Home/LocalHome intf, findByPrimaryKey too
    if (parentDesc.isRemoteInterfacesSupported()) {
        Class homeIntf = getClass(parentDesc.getHomeClassName());
        Method[] homeMethods = homeIntf.getMethods();
        for (int i = 0; i < homeMethods.length; i++) {
            String name = homeMethods[i].getName();
            if (name.startsWith("find") && !name.equals("findByPrimaryKey")) {
                allQueriedMethods.add(new MethodDescriptor(homeMethods[i], MethodDescriptor.EJB_HOME));
            }
        }
    }
    if (parentDesc.isLocalInterfacesSupported()) {
        Class homeIntf = getClass(parentDesc.getLocalHomeClassName());
        Method[] homeMethods = homeIntf.getMethods();
        for (int i = 0; i < homeMethods.length; i++) {
            String name = homeMethods[i].getName();
            if (name.startsWith("find") && !name.equals("findByPrimaryKey")) {
                allQueriedMethods.add(new MethodDescriptor(homeMethods[i], MethodDescriptor.EJB_LOCALHOME));
            }
        }
    }
}
Also used : Method(java.lang.reflect.Method) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) HashSet(java.util.HashSet)

Example 72 with MethodDescriptor

use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.

the class CheckpointAtEndOfMethodDescriptor method convertStyleCheckpointedMethods.

private void convertStyleCheckpointedMethods() {
    Set allMethods = ejbDescriptor.getMethodDescriptors();
    for (Iterator mdItr = methodDescs.iterator(); mdItr.hasNext(); ) {
        MethodDescriptor methodDesc = (MethodDescriptor) mdItr.next();
        // the ejb-name element defined in the method element will
        // be always ignored and overriden by the one defined in
        // ejb element
        methodDesc.setEjbName(ejbDescriptor.getName());
        // Convert to style 3 method descriptors
        Vector mds = methodDesc.doStyleConversion(ejbDescriptor, allMethods);
        convertedMethodDescs.addAll(mds);
    }
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) Vector(java.util.Vector)

Example 73 with MethodDescriptor

use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.

the class FlushAtEndOfMethodDescriptor method convertStyleFlushedMethods.

private void convertStyleFlushedMethods() {
    Set allMethods = ejbDescriptor.getMethodDescriptors();
    for (Iterator mdItr = methodDescs.iterator(); mdItr.hasNext(); ) {
        MethodDescriptor methodDesc = (MethodDescriptor) mdItr.next();
        // the ejb-name element defined in the method element will
        // be always ignored and overriden by the one defined in
        // ejb element
        methodDesc.setEjbName(ejbDescriptor.getName());
        // Convert to style 3 method descriptors
        Vector mds = methodDesc.doStyleConversion(ejbDescriptor, allMethods);
        convertedMethodDescs.addAll(mds);
    }
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) Vector(java.util.Vector)

Example 74 with MethodDescriptor

use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.

the class IASEjbExtraDescriptors method parseCheckpointedMethod.

// parse the given method string into a MethodDescriptor
private MethodDescriptor parseCheckpointedMethod(String method) {
    String methodName, methodParams;
    ArrayList paramTypeList = new ArrayList();
    try {
        if (method.indexOf(LEFT_PAREN) != -1 && method.indexOf(RIGHT_PAREN) != -1) {
            int pos = method.indexOf(LEFT_PAREN);
            int pos2 = method.indexOf(RIGHT_PAREN);
            // retrieve the method name
            methodName = method.substring(0, pos).trim();
            // retrieve the parameter list
            if (pos < pos2 - 1) {
                methodParams = method.substring(pos + 1, pos2).trim();
                StringTokenizer paramsTokenizer = new StringTokenizer(methodParams, PARAMS_DELIM);
                while (paramsTokenizer.hasMoreTokens()) {
                    // process each param
                    String param = paramsTokenizer.nextToken().trim();
                    if (param.length() == 0) {
                        continue;
                    }
                    StringTokenizer paramTokenizer = new StringTokenizer(param, PARAM_DELIM);
                    while (paramTokenizer.hasMoreTokens()) {
                        String paramType = paramTokenizer.nextToken().trim();
                        if (paramType.length() != 0) {
                            paramTypeList.add(paramType);
                            // only interested in the first token
                            break;
                        }
                    }
                }
            }
            if (paramTypeList.size() > 0) {
                String[] paramTypeArray = (String[]) paramTypeList.toArray(new String[paramTypeList.size()]);
                return new MethodDescriptor(methodName, null, paramTypeArray, null);
            } else {
                return new MethodDescriptor(methodName, null, null, null);
            }
        } else {
            DOLUtils.getDefaultLogger().log(Level.WARNING, "enterprise.deployment_badformat_checkpointedmethods", new Object[] { method });
            return null;
        }
    } catch (Exception e) {
        // any parsing exception indicates it is not a well-formed
        // string, we will just print warning and return null
        DOLUtils.getDefaultLogger().log(Level.WARNING, "enterprise.deployment_badformat_checkpointedmethods", new Object[] { method });
        DOLUtils.getDefaultLogger().log(Level.WARNING, e.getMessage(), e);
        return null;
    }
}
Also used : StringTokenizer(java.util.StringTokenizer) ArrayList(java.util.ArrayList) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor)

Example 75 with MethodDescriptor

use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.

the class PrefetchDisabledDescriptor method convertStylePrefetchDisabledMethods.

private void convertStylePrefetchDisabledMethods() {
    Set allMethods = ejbDescriptor.getMethodDescriptors();
    for (Iterator mdItr = methodDescs.iterator(); mdItr.hasNext(); ) {
        MethodDescriptor methodDesc = (MethodDescriptor) mdItr.next();
        // the ejb-name element defined in the method element will
        // be always ignored and overriden by the one defined in
        // ejb element
        methodDesc.setEjbName(ejbDescriptor.getName());
        // Convert to style 3 method descriptors
        Vector mds = methodDesc.doStyleConversion(ejbDescriptor, allMethods);
        convertedMethodDescs.addAll(mds);
    }
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) Vector(java.util.Vector)

Aggregations

MethodDescriptor (com.sun.enterprise.deployment.MethodDescriptor)97 Method (java.lang.reflect.Method)37 Iterator (java.util.Iterator)25 EjbSessionDescriptor (org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor)23 Set (java.util.Set)18 ContainerTransaction (org.glassfish.ejb.deployment.descriptor.ContainerTransaction)17 Enumeration (java.util.Enumeration)16 ArrayList (java.util.ArrayList)12 ComponentNameConstructor (com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor)11 MethodPermission (com.sun.enterprise.deployment.MethodPermission)10 EjbContext (com.sun.enterprise.deployment.annotation.context.EjbContext)10 EjbDescriptor (org.glassfish.ejb.deployment.descriptor.EjbDescriptor)10 Result (com.sun.enterprise.tools.verifier.Result)9 HashSet (java.util.HashSet)9 Vector (java.util.Vector)7 EjbEntityDescriptor (org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor)7 MethodNode (com.sun.enterprise.deployment.node.MethodNode)6 Collection (java.util.Collection)6 HashMap (java.util.HashMap)6 ScheduledTimerDescriptor (org.glassfish.ejb.deployment.descriptor.ScheduledTimerDescriptor)6