endpointinterfacedescriptionimpl.java
来自「开源的axis2框架的源码。用于开发WEBSERVER」· Java 代码 · 共 1,033 行 · 第 1/4 页
JAVA
1,033 行
*/
private static MethodDescriptionComposite getBaseMethod(MethodDescriptionComposite mdc,
int index,
ArrayList<MethodDescriptionComposite> methodList,
HashMap<String, Integer>
hierarchyMap) {
int baseLevel = hierarchyMap.get(mdc.getDeclaringClass());
if (log.isDebugEnabled()) {
log.debug("Base method: " + mdc.getMethodName() + " initial level: " + baseLevel);
}
for (; index < methodList.size(); index++) {
MethodDescriptionComposite compareMDC = methodList.get(index);
// If the two methods are the same method that means we have found an inherited
// overridden case
if (mdc.equals(compareMDC)) {
if (log.isDebugEnabled()) {
log.debug("Found equivalent methods: " + mdc.getMethodName());
}
// get the declaration level of the method we are comparing to
int compareLevel = hierarchyMap.get(compareMDC.getDeclaringClass());
// if the method was declared by a class in a lower level of the hierarchy it
// becomes the method that we will compare other methods to
if (compareLevel < baseLevel) {
if (log.isDebugEnabled()) {
log.debug("Found method lower in hierarchy chain: " +
compareMDC.getMethodName()
+ " of class: " + compareMDC.getMethodName());
}
mdc = compareMDC;
baseLevel = compareLevel;
}
}
}
return mdc;
}
/*
* This is called when we know that this DBC is an implicit SEI
*/
private ArrayList<MethodDescriptionComposite> retrieveImplicitSEIMethods(
DescriptionBuilderComposite dbc) {
ArrayList<MethodDescriptionComposite> retrieveList =
new ArrayList<MethodDescriptionComposite>();
retrieveList = DescriptionUtils.getMethodsWithFalseExclusions(dbc);
//If this list is empty, then there are no false exclusions, so gather
//all composites that don't have exclude == true
//If the list is not empty, then it means we found at least one method with 'exclude==false'
//so the list should contain only those methods
if (retrieveList == null || retrieveList.size() == 0) {
Iterator<MethodDescriptionComposite> iter = null;
List<MethodDescriptionComposite> mdcList = dbc.getMethodDescriptionsList();
if (mdcList != null) {
iter = dbc.getMethodDescriptionsList().iterator();
while (iter.hasNext()) {
MethodDescriptionComposite mdc = iter.next();
if (!DescriptionUtils.isExcludeTrue(mdc)) {
mdc.setDeclaringClass(dbc.getClassName());
retrieveList.add(mdc);
}
}
}
}
return retrieveList;
}
private ArrayList<MethodDescriptionComposite> retrieveSEIMethods(
DescriptionBuilderComposite dbc) {
//Rules for retrieving Methods on an SEI (or a superclass of an SEI) are simple
//Just retrieve all methods regardless of WebMethod annotations
ArrayList<MethodDescriptionComposite> retrieveList =
new ArrayList<MethodDescriptionComposite>();
Iterator<MethodDescriptionComposite> iter = null;
List<MethodDescriptionComposite> mdcList = dbc.getMethodDescriptionsList();
if (mdcList != null) {
iter = dbc.getMethodDescriptionsList().iterator();
while (iter.hasNext()) {
MethodDescriptionComposite mdc = iter.next();
mdc.setDeclaringClass(dbc.getClassName());
retrieveList.add(mdc);
}
}
return retrieveList;
}
private ArrayList<MethodDescriptionComposite> retrieveSEIMethodsChain(
DescriptionBuilderComposite tmpDBC) {
DescriptionBuilderComposite dbc = tmpDBC;
ArrayList<MethodDescriptionComposite> retrieveList =
new ArrayList<MethodDescriptionComposite>();
retrieveList = retrieveSEIMethods(dbc);
//Since this is an interface, anything that is in the extends clause will actually appear
// in the interfaces list instead.
Iterator<String> iter = null;
List<String> interfacesList = dbc.getInterfacesList();
if (interfacesList != null) {
iter = dbc.getInterfacesList().iterator();
while (iter.hasNext()) {
String interfaceName = iter.next();
DescriptionBuilderComposite superInterface =
getEndpointDescriptionImpl().getServiceDescriptionImpl().getDBCMap()
.get(interfaceName);
retrieveList.addAll(retrieveSEIMethodsChain(superInterface));
}
}
return retrieveList;
}
private Definition getWSDLDefinition() {
return ((ServiceDescriptionWSDL)getEndpointDescription().getServiceDescription())
.getWSDLDefinition();
}
public PortType getWSDLPortType() {
PortType portType = null;
// EndpointDescriptionWSDL endpointDescWSDL = (EndpointDescriptionWSDL) getEndpointDescription();
// Binding wsdlBinding = endpointDescWSDL.getWSDLBinding();
// if (wsdlBinding != null) {
// portType = wsdlBinding.getPortType();
// }
Definition wsdlDefn = getWSDLDefinition();
if (wsdlDefn != null) {
String tns = getEndpointDescription().getTargetNamespace();
String localPart = getEndpointDescription().getName();
if (localPart != null) {
portType = wsdlDefn.getPortType(new QName(tns, localPart));
}
}
return portType;
}
public String getTargetNamespace() {
// REVIEW: WSDL/Anno mertge
return getAnnoWebServiceTargetNamespace();
}
public WebService getAnnoWebService() {
// TODO Auto-generated method stub
if (webServiceAnnotation == null) {
if (dbc != null) {
webServiceAnnotation = dbc.getWebServiceAnnot();
} else {
if (seiClass != null) {
webServiceAnnotation = (WebService)seiClass.getAnnotation(WebService.class);
}
}
}
return webServiceAnnotation;
}
public String getAnnoWebServiceTargetNamespace() {
if (webServiceTargetNamespace == null) {
if (getAnnoWebService() != null
&& !DescriptionUtils.isEmpty(getAnnoWebService().targetNamespace())) {
webServiceTargetNamespace = getAnnoWebService().targetNamespace();
} else {
// Default value per JSR-181 MR Sec 4.1 pg 15 defers to "Implementation defined,
// as described in JAX-WS 2.0, section 3.2" which is JAX-WS 2.0 Sec 3.2, pg 29.
// FIXME: Hardcoded protocol for namespace
if (dbc != null)
webServiceTargetNamespace =
DescriptionUtils.makeNamespaceFromPackageName(
DescriptionUtils.getJavaPackageName(dbc.getClassName()),
"http");
else
webServiceTargetNamespace =
DescriptionUtils.makeNamespaceFromPackageName(
DescriptionUtils.getJavaPackageName(seiClass), "http");
}
}
return webServiceTargetNamespace;
}
public String getAnnoWebServiceName() {
//REVIEW the following, used to get Port
if (webService_Name == null) {
if (getAnnoWebService() != null
&& !DescriptionUtils.isEmpty(getAnnoWebService().name())) {
webService_Name = getAnnoWebService().name();
} else {
webService_Name = "";
}
}
return webService_Name;
}
public String getName() {
return getAnnoWebServiceName();
}
public QName getPortType() {
String name = getName();
String tns = getTargetNamespace();
return new QName(tns, name);
}
public String toString() {
final String newline = "\n";
final String sameline = "; ";
StringBuffer string = new StringBuffer();
try {
string.append(super.toString());
string.append(newline);
string.append("Name: " + getName());
string.append(sameline);
string.append("PortType: " + getPortType());
//
string.append(newline);
string.append("SOAP Style: " + getSoapBindingStyle());
string.append(sameline);
string.append("SOAP Use: " + getSoapBindingUse());
string.append(sameline);
string.append("SOAP Paramater Style: " + getSoapBindingParameterStyle());
//
string.append(newline);
OperationDescription[] operations = getOperations();
if (operations != null && operations.length > 0) {
string.append("Number of operations: " + operations.length);
for (OperationDescription operation : operations) {
string.append(newline);
string.append("Operation: " + operation.toString());
}
} else {
string.append("OperationDescription array is null");
}
}
catch (Throwable t) {
string.append(newline);
string.append("Complete debug information not currently available for " +
"EndpointInterfaceDescription");
return string.toString();
}
return string.toString();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?