gpt4 book ai didi

org.codehaus.enunciate.contract.jaxws.WebFault类的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 17:45:05 25 4
gpt4 key购买 nike

本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault类的一些代码示例,展示了WebFault类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebFault类的具体详情如下:
包路径:org.codehaus.enunciate.contract.jaxws.WebFault
类名称:WebFault

WebFault介绍

[英]A fault that is declared potentially thrown in some web service call.
[中]声明可能在某个web服务调用中引发的错误。

代码示例

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

/**
 * Calculates a namespace URI for a given package.  Default implementation uses the algorithm defined in
 * section 3.2 of the jax-ws spec.
 *
 * @return The calculated namespace uri.
 */
protected String calculateNamespaceURI() {
 PackageDeclaration pkg = getPackage();
 if ((pkg == null) || ("".equals(pkg.getQualifiedName()))) {
  throw new ValidationException(getPosition(), getQualifiedName() + ": a web fault in no package must specify a target namespace.");
 }
 String[] tokens = pkg.getQualifiedName().split("\\.");
 String uri = "http://";
 for (int i = tokens.length - 1; i >= 0; i--) {
  uri += tokens[i];
  if (i != 0) {
   uri += ".";
  }
 }
 uri += "/";
 return uri;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

/**
 * The qualified name of the implicit fault bean of this web fault, or null if this web fault
 * does not define an implicit faul bean.
 *
 * @return The qualified name of the implicit fault bean of this web fault.
 */
public String getImplicitFaultBeanQualifiedName() {
 String faultBean = null;
 if (isImplicitSchemaElement()) {
  faultBean = getPackage().getQualifiedName() + ".jaxws." + getSimpleName() + "Bean";
  if ((annotation != null) && (annotation.faultBean() != null) && (!"".equals(annotation.faultBean()))) {
   faultBean = annotation.faultBean();
  }
 }
 return faultBean;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

/**
 * Validates a web fault.
 *
 * @param webFault       The web fault to validate.
 * @param alreadyVisited The bean names that have alrady been visited.
 * @return The validation result.
 */
public ValidationResult validateWebFault(WebFault webFault, Set<String> alreadyVisited) {
 AnnotationProcessorEnvironment ape = Context.getCurrentEnvironment();
 ValidationResult result = new ValidationResult();
 if (webFault.isImplicitSchemaElement()) {
  String faultBeanFQN = webFault.getImplicitFaultBeanQualifiedName();
  if (!alreadyVisited.add(faultBeanFQN)) {
   result.addError(webFault.getPosition(), faultBeanFQN + " conflicts with another generated bean name.  Please use the @WebFault annotation " +
    "to customize the fault bean name.");
  }
  else if (ape.getTypeDeclaration(faultBeanFQN) != null) {
   result.addError(webFault.getPosition(), faultBeanFQN + " is an existing class.  Either move it, or customize the fault bean name with the " +
    "@WebFault annotation.");
  }
 }
 return result;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

/**
 * The qname reference to the fault info.
 *
 * @return The qname reference to the fault info.
 */
public QName getParticleQName() {
 ElementDeclaration faultBean = findExplicitFaultBean();
 if (faultBean != null) {
  return new QName(faultBean.getNamespace(), faultBean.getName());
 }
 else {
  return new QName(getTargetNamespace(), getElementName());
 }
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

/**
 * The qname reference to the fault info.
 *
 * @return The qname reference to the fault info.
 */
public QName getParticleQName() {
 if (this.explicitFaultBean != null) {
  return new QName(this.explicitFaultBean.getNamespace(), this.explicitFaultBean.getName());
 }
 else {
  return new QName(getTargetNamespace(), getElementName());
 }
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

/**
 * Gets the target namespace of the implicit fault bean, or null if this web fault defines
 * an explicit fault info bean.
 *
 * @return the target namespace of the implicit fault bean, or null.
 */
public String getTargetNamespace() {
 String targetNamespace = null;
 if (isImplicitSchemaElement()) {
  if (annotation != null) {
   targetNamespace = annotation.targetNamespace();
  }
  if ((targetNamespace == null) || ("".equals(targetNamespace))) {
   targetNamespace = calculateNamespaceURI();
  }
 }
 return targetNamespace;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-xfire-client

allFaults.put(fault.getQualifiedName(), fault);
boolean implicit = webFault.isImplicitSchemaElement();
String faultBean = implicit ? getBeanName(classnameFor, webFault.getImplicitFaultBeanQualifiedName()) : classnameFor.convert(webFault.getExplicitFaultBeanType());
ElementDeclaration explicitFaultBean = webFault.findExplicitFaultBean();
String faultElementName = explicitFaultBean == null ? webFault.getElementName() : explicitFaultBean.getName();
String faultElementNamespace = explicitFaultBean == null ? webFault.getTargetNamespace() : explicitFaultBean.getNamespace();
this.generatedAnnotations.fault2WebFault.put(faultClass, new WebFaultAnnotation(faultElementName, faultElementNamespace, faultBean, implicit));
 ClassDeclaration superFault = webFault.getSuperclass().getDeclaration();
 if (superFault != null && allFaults.containsKey(superFault.getQualifiedName()) && allFaults.get(superFault.getQualifiedName()).isImplicitSchemaElement()) {
  model.put("superFault", allFaults.get(superFault.getQualifiedName()));
 ClassDeclaration superFault = webFault.getSuperclass().getDeclaration();
 if (superFault != null && allFaults.containsKey(superFault.getQualifiedName()) && allFaults.get(superFault.getQualifiedName()).isImplicitSchemaElement()) {
  model.put("superFault", allFaults.get(superFault.getQualifiedName()));

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

allFaults.put(fault.getQualifiedName(), fault);
boolean implicit = webFault.isImplicitSchemaElement();
String faultBean = implicit ? getBeanName(classnameFor, webFault.getImplicitFaultBeanQualifiedName()) : classnameFor.convert(webFault.getExplicitFaultBean());
String faultElementName = webFault.isImplicitSchemaElement() ? webFault.getElementName() : webFault.getExplicitFaultBean().getName();
String faultElementNamespace = webFault.isImplicitSchemaElement() ? webFault.getTargetNamespace() : webFault.getExplicitFaultBean().getNamespace();
this.generatedAnnotations.fault2WebFault.put(faultClass, new WebFaultAnnotation(faultElementName, faultElementNamespace, faultBean, implicit));
ClassDeclaration superFault = webFault.getSuperclass().getDeclaration();
if (superFault != null && allFaults.containsKey(superFault.getQualifiedName()) && allFaults.get(superFault.getQualifiedName()).isImplicitSchemaElement()) {
 model.put("superFault", allFaults.get(superFault.getQualifiedName()));
ClassDeclaration superFault = webFault.getSuperclass().getDeclaration();
if (superFault != null && allFaults.containsKey(superFault.getQualifiedName()) && allFaults.get(superFault.getQualifiedName()).isImplicitSchemaElement()) {
 model.put("superFault", allFaults.get(superFault.getQualifiedName()));

代码示例来源:origin: org.codehaus.enunciate/enunciate-java-client

allFaults.put(fault.getQualifiedName(), fault);
 boolean implicit = webFault.isImplicitSchemaElement();
 String faultBean = implicit ? getBeanName(classnameFor, webFault.getImplicitFaultBeanQualifiedName()) : classnameFor.convert(webFault.getExplicitFaultBeanType());
 seeAlsos.add(faultBean);
for (WebFault webFault : allFaults.values()) {
 if (useServerSide(webFault, matcher)) {
  SourcePosition position = webFault.getPosition();
  if (position == null || position.file() == null) {
   throw new IllegalStateException("Unable to find source file for " + webFault.getQualifiedName());
  ClassDeclaration superFault = webFault.getSuperclass().getDeclaration();
  if (superFault != null && allFaults.containsKey(superFault.getQualifiedName()) && allFaults.get(superFault.getQualifiedName()).isImplicitSchemaElement()) {
   model.put("superFault", allFaults.get(superFault.getQualifiedName()));

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

public WebFault(ClassDeclaration delegate) {
 super(delegate);
 this.annotation = getAnnotation(javax.xml.ws.WebFault.class);
 Collection<PropertyDeclaration> properties = getProperties();
 PropertyDeclaration faultInfoProperty = null;
 for (PropertyDeclaration propertyDeclaration : properties) {
  Collection<ConstructorDeclaration> constructors = getConstructors();
  for (ConstructorDeclaration constructor : constructors) {
   if (constructor.getModifiers().contains(Modifier.PUBLIC)) {
    throw new ValidationException(getPosition(), "The faultInfo bean for a web fault must be a root element.  " + explicitFaultClass.getQualifiedName()
     + " must be annotated with @XmlRootElement.");

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

protected Iterator<WebFault> getLoop(TemplateModel model) throws TemplateException {
 WsdlInfo wsdl = this.wsdl;
 if (wsdl == null) {
  throw new MissingParameterException("wsdl");
 }
 HashMap<String, WebFault> declaredFaults = new HashMap<String, WebFault>();
 for (EndpointInterface ei : wsdl.getEndpointInterfaces()) {
  Collection<WebMethod> webMethods = ei.getWebMethods();
  for (WebMethod webMethod : webMethods) {
   for (WebFault webFault : webMethod.getWebFaults()) {
    declaredFaults.put(webFault.getQualifiedName(), webFault);
   }
  }
 }
 return declaredFaults.values().iterator();
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

/**
 * Adds any type definitions referenced by a web fault.
 *
 * @param webFault The web fault.
 */
protected void addReferencedTypeDefinitions(WebFault webFault) {
 if (webFault.isImplicitSchemaElement()) {
  for (ImplicitChildElement childElement : webFault.getChildElements()) {
   WebFault.FaultBeanChildElement fbce = (WebFault.FaultBeanChildElement) childElement;
   REFERENCE_STACK.get().addFirst("property " + fbce.getProperty().getSimpleName());
   addReferencedTypeDefinitions(fbce.isAdapted() ? fbce.getAdapterType() : fbce.getType());
   REFERENCE_STACK.get().removeFirst();
  }
 }
 else {
  REFERENCE_STACK.get().addFirst("explicit fault bean");
  ClassType faultBeanType = webFault.getExplicitFaultBeanType();
  if (faultBeanType != null) {
   addReferencedTypeDefinitions(faultBeanType);
  }
  REFERENCE_STACK.get().removeFirst();
 }
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-jaxws

/**
 * Validates a web fault.
 *
 * @param webFault       The web fault to validate.
 * @param alreadyVisited The bean names that have alrady been visited.
 * @return The validation result.
 */
public ValidationResult validateWebFault(WebFault webFault, Set<String> alreadyVisited) {
 AnnotationProcessorEnvironment ape = Context.getCurrentEnvironment();
 ValidationResult result = new ValidationResult();
 if (webFault.isImplicitSchemaElement()) {
  String faultBeanFQN = webFault.getImplicitFaultBeanQualifiedName();
  if (!alreadyVisited.add(faultBeanFQN)) {
   result.addError(webFault, faultBeanFQN + " conflicts with another generated bean name.  Please use the @WebFault annotation " +
    "to customize the fault bean name.");
  }
  else if (ape.getTypeDeclaration(faultBeanFQN) != null) {
   result.addError(webFault, faultBeanFQN + " is an existing class.  Either move it, or customize the fault bean name with the " +
    "@WebFault annotation.");
  }
 }
 return result;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

/**
 * The element name of the implicit web fault bean, or null if this isn't an implicit web fault.
 *
 * @return The element name of the implicit web fault, or null.
 */
public String getElementName() {
 String name = null;
 if (isImplicitSchemaElement()) {
  name = getSimpleName();
  if ((annotation != null) && (annotation.name() != null) && (!"".equals(annotation.name()))) {
   name = annotation.name();
  }
 }
 return name;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

/**
 * Calculates a namespace URI for a given package.  Default implementation uses the algorithm defined in
 * section 3.2 of the jax-ws spec.
 *
 * @return The calculated namespace uri.
 */
protected String calculateNamespaceURI() {
 PackageDeclaration pkg = getPackage();
 if ((pkg == null) || ("".equals(pkg.getQualifiedName()))) {
  throw new ValidationException(getPosition(), "A web service in no package must specify a target namespace.");
 }
 String[] tokens = pkg.getQualifiedName().split("\\.");
 String uri = "http://";
 for (int i = tokens.length - 1; i >= 0; i--) {
  uri += tokens[i];
  if (i != 0) {
   uri += ".";
  }
 }
 uri += "/";
 return uri;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-gwt

String pckg = webFault.getPackage().getQualifiedName();
if (!pckg.startsWith(this.rpcModuleNamespace) && !conversions.containsKey(pckg) && (getKnownGwtModule(webFault) == null)) {
 conversions.put(pckg, clientNamespace + "." + pckg);
 debug("Skipping generating fault for %s because it's in a known GWT module.", webFault.getQualifiedName());
model.put("fault", webFault);
processTemplate(faultMapperTemplate, model);
gwt2jaxbMappings.setProperty(classnameFor.convert(webFault), webFault.getQualifiedName());

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

if (!isImplicitSchemaElement()) {
 return Collections.emptyList();
for (PropertyDeclaration property : getAllFaultProperties(this)) {
 String propertyName = property.getPropertyName();
 if (("cause".equals(propertyName)) || ("localizedMessage".equals(propertyName)) || ("stackTrace".equals(propertyName)) || "suppressed".equals(propertyName)) {
final WebFaultPropertyOrder propOrder = getAnnotation(WebFaultPropertyOrder.class);
if (propOrder != null) {
 Set<ImplicitChildElement> resorted = new TreeSet<ImplicitChildElement>(new Comparator<ImplicitChildElement>() {

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

public int compare(ImplicitChildElement o1, ImplicitChildElement o2) {
  int index1 = -1;
  int index2 = -1;
  for (int i = 0; i < propOrder.value().length; i++) {
   String prop = propOrder.value()[i];
   if (o1.getElementName().equals(prop)) {
    index1 = i;
   }
   if (o2.getElementName().equals(prop)) {
    index2 = i;
   }
  }
  if (index1 < 0) {
   throw new ValidationException(WebFault.this.getPosition(), WebFault.this.getQualifiedName() + ": @WebFaultPropertyOrder doesn't specify a property '" + o1.getElementName() + "'.");
  }
  else if (index2 < 0) {
   throw new ValidationException(WebFault.this.getPosition(), WebFault.this.getQualifiedName() + ": @WebFaultPropertyOrder doesn't specify a property '" + o2.getElementName() + "'.");
  }
  else {
   return index1 - index2;
  }
 }
});

代码示例来源:origin: org.codehaus.enunciate/enunciate-jaxws

processTemplate(responseBeanTemplate, model);
else if ((webMessage instanceof WebFault) && ((WebFault) webMessage).isImplicitSchemaElement() && visitedFaults.add((WebFault) webMessage)) {
 model.put("message", webMessage);
 processTemplate(faultBeanTemplate, model);
WebFault fault = new WebFault((ClassDeclaration) declaration);
if (fault.isImplicitSchemaElement() && visitedFaults.add(fault)) {
 model.put("message", fault);
 processTemplate(faultBeanTemplate, model);

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

/**
 * If this is an implicit fault bean, return the child elements.
 *
 * @return The child elements of the bean, or null if none.
 */
public Collection<ImplicitChildElement> getChildElements() {
 if (!isImplicitSchemaElement()) {
  return Collections.emptyList();
 }
 Collection<ImplicitChildElement> childElements = new ArrayList<ImplicitChildElement>();
 for (PropertyDeclaration property : getAllProperties(this)) {
  String propertyName = property.getPropertyName();
  if (("cause".equals(propertyName)) || ("localizedMessage".equals(propertyName)) || ("stackTrace".equals(propertyName))) {
   continue;
  }
  childElements.add(new FaultBeanChildElement(property));
 }
 return childElements;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com