public boolean hasScheduledTimerMethodFromDD(Method timerMethod) { boolean match = false; for(MethodDescriptor next : timerMethodDescriptors) { if( next.getName().equals(timerMethod.getName()) && ( next.getParameterClassNames() == null || next.getParameterClassNames().length == timerMethod.getParameterTypes().length) ) { match = true; break; } } return match; }
public boolean hasScheduledTimerMethodFromDD(Method timerMethod) { boolean match = false; for(MethodDescriptor next : timerMethodDescriptors) { if( next.getName().equals(timerMethod.getName()) && ( next.getParameterClassNames() == null || next.getParameterClassNames().length == timerMethod.getParameterTypes().length) ) { match = true; break; } } return match; }
/** * writes the method parameters to the DOM Tree * * @param the parent node for the parameters * @param the method descriptor */ private void writeMethodParams(Node paramsNode, MethodDescriptor descriptor) { String[] params = descriptor.getParameterClassNames(); if (params==null) return; for (int i=0; i<params.length;i++) { appendTextChild(paramsNode, RuntimeTagNames.METHOD_PARAM, params[i]); } } }
/** * writes the method parameters to the DOM Tree * * @param the parent node for the parameters * @param the method descriptor */ private void writeMethodParams(Node paramsNode, MethodDescriptor descriptor) { String[] params = descriptor.getParameterClassNames(); if (params==null) return; for (int i=0; i<params.length;i++) { appendTextChild(paramsNode, RuntimeTagNames.METHOD_PARAM, params[i]); } } }
/** * <p> * @return the style level of this method descriptors. According to the J2EE spec, methods * can be described byt using style 1, style 2 or style 3 xml tags. * </p> */ public int getStyle() { if ( (getName().equals(ALL_METHODS)) ) { return 1; } if (getParameterClassNames()==null) return 2; return 3; }
/** * <p> * @return the style level of this method descriptors. According to the J2EE spec, methods * can be described byt using style 1, style 2 or style 3 xml tags. * </p> */ public int getStyle() { if ( (getName().equals(ALL_EJB_METHODS)) ) { return 1; } if (getParameterClassNames()==null) return 2; return 3; }
/** Returns true if I have enough information to specifiy a unique method * on an ejb's home or remote interface unambiguously. */ public boolean isExact() { if (isExact) { return true; } boolean isExactName = !this.getName().equals(ALL_METHODS); boolean hasMethodIntf = getEjbClassSymbol()!=null; boolean hasParamsListed = (this.getParameterClassNames() != null); return isExactName && hasMethodIntf && hasParamsListed; }
/** Indicates if a method descriptor implies the other one*/ public boolean implies(Object other) { if (other != null && other instanceof MethodDescriptor) { MethodDescriptor otherMethodDescriptor = (MethodDescriptor) other; if (getName().equals(ALL_METHODS) || getName().equals(otherMethodDescriptor.getName())) { if (getParameterClassNames() == null || stringArrayEquals(getParameterClassNames(), otherMethodDescriptor.getParameterClassNames())) { return true; } } } return false; }
/** Indicates if a method descriptor implies the other one*/ public boolean implies(Object other) { if (other != null && other instanceof MethodDescriptor) { MethodDescriptor otherMethodDescriptor = (MethodDescriptor) other; if (getName().equals(ALL_METHODS) || getName().equals(otherMethodDescriptor.getName())) { if (getParameterClassNames() == null || stringArrayEquals(getParameterClassNames(), otherMethodDescriptor.getParameterClassNames())) { return true; } } } return false; }
/** Returns true if I have enough information to specifiy a unique method * on an ejb's home or remote interface unambiguously. */ public boolean isExact() { if (isExact) { return true; } boolean isExactName = !this.getName().equals(ALL_EJB_METHODS); boolean hasMethodIntf = getEjbClassSymbol()!=null; boolean hasParamsListed = (this.getParameterClassNames() != null); return isExactName && hasMethodIntf && hasParamsListed; }
private Set getMethodDescriptorsOfNameAndParameters(String name, String[] parameterArray, Collection methodDescriptors) { Set methods = new HashSet(); for (Iterator itr = getMethodDescriptorsOfName(name, methodDescriptors).iterator(); itr.hasNext();) { MethodDescriptor next = (MethodDescriptor) itr.next(); next.setEjbName(getEjbName()); if (stringArrayEquals(parameterArray, next.getParameterClassNames())) { methods.add(next); } } return methods; }
private Set getMethodDescriptorsOfNameAndParameters(String name, String[] parameterArray, Collection methodDescriptors) { Set methods = new HashSet(); for (Iterator itr = getMethodDescriptorsOfName(name, methodDescriptors).iterator(); itr.hasNext();) { MethodDescriptor next = (MethodDescriptor) itr.next(); next.setEjbName(getEjbName()); if (stringArrayEquals(parameterArray, next.getParameterClassNames())) { methods.add(next); } } return methods; }
private void doStyleConversion() { 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; }
private void doStyleConversion() { 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; }
@Override public boolean endElement(XMLElement element) { String qname = element.getQName(); if (TagNames.METHOD_PARAMS.equals(qname)) { MethodDescriptor desc = getDescriptor(); // this means we have an empty method-params element // which means this method has no input parameter if (desc.getParameterClassNames() == null) { desc.setEmptyParameterClassNames(); } } return super.endElement(element); }
/** Equlity iff the parameter names match and the name matches.*/ public boolean equals(Object other) { if (other instanceof MethodDescriptor) { MethodDescriptor otherMethodDescriptor = (MethodDescriptor) other; if (otherMethodDescriptor.getName().equals(getName()) && stringArrayEquals(otherMethodDescriptor.getParameterClassNames(), getParameterClassNames())) { if (getEjbClassSymbol()!=null && otherMethodDescriptor.getEjbClassSymbol()!=null) { return getEjbClassSymbol().equals(otherMethodDescriptor.getEjbClassSymbol()); } // if the ejb class symbol is not defined in both descriptor, we consider // the method described being the same. return true; } } return false; }
/** * receives notification of the end of an XML element by the Parser * * @param element the xml tag identification * @return true if this node is done processing the XML sub tree */ public boolean endElement(XMLElement element) { String qname = element.getQName(); if (EjbTagNames.METHOD_PARAMS.equals(qname)) { MethodDescriptor desc = (MethodDescriptor) getDescriptor(); // this means we have an empty method-params element // which means this method has no input parameter if (desc.getParameterClassNames() == null) { desc.setEmptyParameterClassNames(); } } return super.endElement(element); }
/** Equlity iff the parameter names match and the name matches.*/ public boolean equals(Object other) { if (other instanceof MethodDescriptor) { MethodDescriptor otherMethodDescriptor = (MethodDescriptor) other; if (otherMethodDescriptor.getName().equals(getName()) && stringArrayEquals(otherMethodDescriptor.getParameterClassNames(), getParameterClassNames())) { // If method names and params match, it still can be a wild-card method-name... // And wild-card can be present with farious interfaces or no method-intf at all... if (getEjbClassSymbol()!=null && otherMethodDescriptor.getEjbClassSymbol()!=null) { // Method descriptors are equal if method-intf value is the same, even if they have // wild-card method names return getEjbClassSymbol().equals(otherMethodDescriptor.getEjbClassSymbol()); } else if (getName().equals(ALL_METHODS)) { // For wild-card method names, method descriptors are equal if method-intf value is not set in both return (getEjbClassSymbol() == null && otherMethodDescriptor.getEjbClassSymbol() == null); } // If method name is provided, and parameters match, we consider the method described being the same // if the ejb class symbol (method-intf) is not defined in one of the descriptors return true; } } return false; }
public Node writeDescriptor(Node parent, String nodeName, MethodDescriptor descriptor, String ejbName) { Node methodNode = super.writeDescriptor(parent, nodeName, descriptor); writeLocalizedDescriptions(methodNode, descriptor); if (ejbName != null && ejbName.length() > 0) { appendTextChild(methodNode, TagNames.EJB_NAME, ejbName); } String methodIntfSymbol = descriptor.getEjbClassSymbol(); if( (methodIntfSymbol != null) && !methodIntfSymbol.equals(MethodDescriptor.EJB_BEAN) ) { appendTextChild(methodNode, TagNames.METHOD_INTF, methodIntfSymbol); } appendTextChild(methodNode, TagNames.METHOD_NAME, descriptor.getName()); if (descriptor.getParameterClassNames()!=null) { Node paramsNode = appendChild(methodNode, TagNames.METHOD_PARAMS); writeMethodParams(paramsNode, descriptor); } return methodNode; }
/** * write the method descriptor class to a java-method DOM tree and return it * * @param parent node in the DOM tree * @param node name for the root element of this xml fragment * @param the descriptor to write * @return the DOM tree top node */ public Node writeJavaMethodDescriptor(Node parent, String nodeName, MethodDescriptor descriptor, boolean writeEmptyMethodParamsElementForVoidMethods) { Node methodNode = super.writeDescriptor(parent, nodeName, descriptor); appendTextChild(methodNode, RuntimeTagNames.METHOD_NAME, descriptor.getName()); if (descriptor.getParameterClassNames() != null) { Node paramsNode = appendChild(methodNode, RuntimeTagNames.METHOD_PARAMS); writeMethodParams(paramsNode, descriptor); } else { if( writeEmptyMethodParamsElementForVoidMethods ) { appendChild(methodNode, RuntimeTagNames.METHOD_PARAMS); } } return methodNode; }