Examples of ExceptionMapping


Examples of de.danet.an.workflow.spis.aii.ExceptionMappingProvider.ExceptionMapping

          logger.debug ("Invocation resulted in: " + e.toString());
      }
      // try to find mapping
      if (e.getCause() != null && exceptionMappings != null) {
          for (Iterator i = exceptionMappings.iterator(); i.hasNext();) {
              ExceptionMapping m = (ExceptionMapping)i.next ();
              if (m.getJavaException().isInstance(e.getCause())) {
                  if (m.getProcessException() == null) {
                      break;
                  }
                  ResultProvider.ExceptionResult eres
                      = new ResultProvider.ExceptionResult
                            (m.getProcessException(), m.getSuspendActivity());
                        if (logger.isDebugEnabled()) {
                            logger.debug
                                ("Exception mapped to: " + eres.toString());
                        }
                  return new InvocationResult (eres);
View Full Code Here

Examples of de.danet.an.workflow.spis.aii.ExceptionMappingProvider.ExceptionMapping

              Class t = Thread.currentThread().getContextClassLoader()
                .loadClass(a.getValue("JavaException"));
                    String suspAttr = a.getValue("SuspendActivity");
                    boolean suspAct = (suspAttr != null)
                        && (suspAttr.equals("true") || suspAttr.equals("1"));
              ExceptionMapping em = new ExceptionMapping
          (t, a.getValue("ProcessException"), suspAct);
              exceptionMappings.add (em);
          } catch (ClassNotFoundException e) {
              throw new SAXException (e);
          }
View Full Code Here

Examples of org.apache.openejb.jee.ExceptionMapping


    private FaultDesc mapException(String faultName, Fault fault) throws DeploymentException {
        Message message = fault.getMessage();
        QName messageQName = message.getQName();
        ExceptionMapping exceptionMapping = (ExceptionMapping) exceptionMap.get(messageQName);
        if (exceptionMapping == null) {
            throw new DeploymentException("No exception mapping for fault " + faultName + " and fault message " + messageQName + " for operation " + operationName);
        }
        String className = exceptionMapping.getExceptionType();
        //TODO investigate whether there are other cases in which the namespace of faultQName can be determined.
        //this is weird, but I can't figure out what it should be.
        //if part has an element rather than a type, it should be part.getElementName() (see below)
        QName faultQName = new QName("", faultName);
        Part part;
        if (exceptionMapping.getWsdlMessagePartName() != null) {
            //According to schema documentation, this will only be set when several headerfaults use the same message.
            String headerFaultMessagePartName = exceptionMapping.getWsdlMessagePartName();
            part = message.getPart(headerFaultMessagePartName);
        } else {
            part = (Part) message.getOrderedParts(null).iterator().next();
        }
        QName faultTypeQName;// = part.getElementName() == null ? part.getTypeName() : part.getElementName();
        if (part.getElementName() == null) {
            faultTypeQName = part.getTypeName();
            if (faultTypeQName == null) {
                throw new DeploymentException("Neither type nor element name supplied for part: " + part);
            }
        } else {
            faultQName = part.getElementName();
            faultTypeQName = (QName) schemaInfoBuilder.getElementToTypeMap().get(part.getElementName());
            if (faultTypeQName == null) {
                throw new DeploymentException("Can not find type for: element: " + part.getElementName() + ", known elements: " + schemaInfoBuilder.getElementToTypeMap());
            }
        }
        SchemaType complexType = (SchemaType) schemaInfoBuilder.getComplexTypesInWsdl().get(faultTypeQName);
        boolean isComplex = complexType != null;
        FaultDesc faultDesc = new FaultDesc(faultQName, className, faultTypeQName, isComplex);

        //constructor parameters
        if (exceptionMapping.getConstructorParameterOrder() != null) {
            if (!isComplex) {
                throw new DeploymentException("ConstructorParameterOrder can only be set for complex types, not " + faultTypeQName);
            }
            Map elementMap = new HashMap();
            SchemaProperty[] properties = complexType.getProperties();
            for (int i = 0; i < properties.length; i++) {
                SchemaProperty property = properties[i];
                QName elementName = property.getName();
                SchemaType elementType = property.getType();
                elementMap.put(elementName.getLocalPart(), elementType);
            }
            ArrayList parameterTypes = new ArrayList();
            ConstructorParameterOrder constructorParameterOrder = exceptionMapping.getConstructorParameterOrder();
            for (String elementName: constructorParameterOrder.getElementName()) {
                SchemaType elementType = (SchemaType) elementMap.get(elementName);
                Class javaElementType;

                QName elementTypeQName = elementType.getName();
View Full Code Here

Examples of org.apache.openejb.jee.ExceptionMapping

        operationInfo.returnJavaType = wsdlReturnValueMapping.getMethodReturnValue();
    }

    private JaxRpcFaultInfo mapFaults(final Fault fault) throws OpenEJBException {
        final Message message = fault.getMessage();
        final ExceptionMapping exceptionMapping = mapping.getExceptionMappingMap().get(message.getQName());
        if (exceptionMapping == null) {
            throw new OpenEJBException("No exception mapping for fault " + fault.getName() + " and fault message " + message.getQName() + " for operation " + operationName);
        }

        // TODO investigate whether there are other cases in which the namespace of faultQName can be determined.
        // this is weird, but I can't figure out what it should be.
        // if part has an element rather than a type, it should be part.getElementName() (see below)
        final Part part;
        if (exceptionMapping.getWsdlMessagePartName() != null) {
            // According to schema documentation, this will only be set when several headerfaults use the same message.
            final String headerFaultMessagePartName = exceptionMapping.getWsdlMessagePartName();
            part = message.getPart(headerFaultMessagePartName);
        } else {
            part = (Part) message.getOrderedParts(null).iterator().next();
        }

        // Determine the fault qname and xml schema type
        final QName faultQName;
        final XmlTypeInfo faultTypeInfo;
        if (part.getElementName() != null) {
            final XmlElementInfo elementInfo = schemaInfo.elements.get(part.getElementName());
            if (elementInfo == null) {
                throw new OpenEJBException("Can not find element: " + part.getElementName() + ", known elements: " + schemaInfo.elements.keySet());
            }
            faultTypeInfo = schemaInfo.types.get(elementInfo.xmlType);
            if (faultTypeInfo == null) {
                throw new OpenEJBException("Can not find type " + elementInfo.xmlType + " for element " + elementInfo.qname + ", known types: " + schemaInfo.types.keySet());
            }

            faultQName = part.getElementName();
        } else if (part.getTypeName() != null) {
            faultTypeInfo = schemaInfo.types.get(part.getTypeName());
            if (faultTypeInfo == null) {
                throw new OpenEJBException("Can not find type: " + part.getTypeName() + ", known elements: " + schemaInfo.types.keySet());
            }

            faultQName = new QName("", fault.getName());
        } else {
            throw new OpenEJBException("Neither type nor element name supplied for part: " + part);
        }

        //
        // Build the fault info
        //
        final JaxRpcFaultInfo faultInfo = new JaxRpcFaultInfo();
        faultInfo.qname = faultQName;
        faultInfo.xmlType = faultTypeInfo.qname;
        faultInfo.javaType = exceptionMapping.getExceptionType();
        faultInfo.complex = faultTypeInfo.simpleBaseType == null;

        //
        // Map exception class constructor args
        //
        if (exceptionMapping.getConstructorParameterOrder() != null) {
            if (faultTypeInfo.simpleBaseType != null) {
                throw new OpenEJBException("ConstructorParameterOrder can only be set for complex types, not " + faultTypeInfo.qname);
            }

            final Map<String, XmlElementInfo> elements = new HashMap<String, XmlElementInfo>();
            for (final XmlElementInfo element : faultTypeInfo.elements.values()) {
                elements.put(element.qname.getLocalPart(), element);
            }

            final ConstructorParameterOrder constructorParameterOrder = exceptionMapping.getConstructorParameterOrder();
            for (int i = 0; i < constructorParameterOrder.getElementName().size(); i++) {
                final String paramName = constructorParameterOrder.getElementName().get(i);

                // get the parameter element
                final XmlElementInfo paramElementInfo = elements.get(paramName);
View Full Code Here

Examples of org.apache.openejb.jee.ExceptionMapping

        operationInfo.returnJavaType = wsdlReturnValueMapping.getMethodReturnValue();
    }

    private JaxRpcFaultInfo mapFaults(Fault fault) throws OpenEJBException {
        Message message = fault.getMessage();
        ExceptionMapping exceptionMapping = mapping.getExceptionMappingMap().get(message.getQName());
        if (exceptionMapping == null) {
            throw new OpenEJBException("No exception mapping for fault " + fault.getName() + " and fault message " + message.getQName() + " for operation " + operationName);
        }

        // TODO investigate whether there are other cases in which the namespace of faultQName can be determined.
        // this is weird, but I can't figure out what it should be.
        // if part has an element rather than a type, it should be part.getElementName() (see below)
        Part part;
        if (exceptionMapping.getWsdlMessagePartName() != null) {
            // According to schema documentation, this will only be set when several headerfaults use the same message.
            String headerFaultMessagePartName = exceptionMapping.getWsdlMessagePartName();
            part = message.getPart(headerFaultMessagePartName);
        } else {
            part = (Part) message.getOrderedParts(null).iterator().next();
        }

        // Determine the fault qname and xml schema type
        QName faultQName;
        XmlTypeInfo faultTypeInfo;
        if (part.getElementName() != null) {
            XmlElementInfo elementInfo = schemaInfo.elements.get(part.getElementName());
            if (elementInfo == null) {
                throw new OpenEJBException("Can not find element: " + part.getElementName() + ", known elements: " + schemaInfo.elements.keySet());
            }
            faultTypeInfo = schemaInfo.types.get(elementInfo.xmlType);
            if (faultTypeInfo == null) {
                throw new OpenEJBException("Can not find type " + elementInfo.xmlType + " for element " + elementInfo.qname + ", known types: " + schemaInfo.types.keySet());
            }

            faultQName = part.getElementName();
        } else if (part.getTypeName() != null) {
            faultTypeInfo = schemaInfo.types.get(part.getTypeName());
            if (faultTypeInfo == null) {
                throw new OpenEJBException("Can not find type: " + part.getTypeName() + ", known elements: " + schemaInfo.types.keySet());
            }

            faultQName = new QName("", fault.getName());
        } else {
            throw new OpenEJBException("Neither type nor element name supplied for part: " + part);
        }

        //
        // Build the fault info
        //
        JaxRpcFaultInfo faultInfo = new JaxRpcFaultInfo();
        faultInfo.qname = faultQName;
        faultInfo.xmlType = faultTypeInfo.qname;
        faultInfo.javaType = exceptionMapping.getExceptionType();
        faultInfo.complex = faultTypeInfo.simpleBaseType == null;

        //
        // Map exception class constructor args
        //
        if (exceptionMapping.getConstructorParameterOrder() != null) {
            if (faultTypeInfo.simpleBaseType != null) {
                throw new OpenEJBException("ConstructorParameterOrder can only be set for complex types, not " + faultTypeInfo.qname);
            }

            Map<String, XmlElementInfo> elements = new HashMap<String, XmlElementInfo>();
            for (XmlElementInfo element : faultTypeInfo.elements.values()) {
                elements.put(element.qname.getLocalPart(), element);
            }

            ConstructorParameterOrder constructorParameterOrder = exceptionMapping.getConstructorParameterOrder();
            for (int i = 0; i < constructorParameterOrder.getElementName().size(); i++) {
                String paramName = constructorParameterOrder.getElementName().get(i);

                // get the parameter element
                XmlElementInfo paramElementInfo = elements.get(paramName);
View Full Code Here

Examples of org.apache.openejb.jee.ExceptionMapping

        operationInfo.returnJavaType = wsdlReturnValueMapping.getMethodReturnValue();
    }

    private JaxRpcFaultInfo mapFaults(Fault fault) throws OpenEJBException {
        Message message = fault.getMessage();
        ExceptionMapping exceptionMapping = mapping.getExceptionMappingMap().get(message.getQName());
        if (exceptionMapping == null) {
            throw new OpenEJBException("No exception mapping for fault " + fault.getName() + " and fault message " + message.getQName() + " for operation " + operationName);
        }

        // TODO investigate whether there are other cases in which the namespace of faultQName can be determined.
        // this is weird, but I can't figure out what it should be.
        // if part has an element rather than a type, it should be part.getElementName() (see below)
        Part part;
        if (exceptionMapping.getWsdlMessagePartName() != null) {
            // According to schema documentation, this will only be set when several headerfaults use the same message.
            String headerFaultMessagePartName = exceptionMapping.getWsdlMessagePartName();
            part = message.getPart(headerFaultMessagePartName);
        } else {
            part = (Part) message.getOrderedParts(null).iterator().next();
        }

        // Determine the fault qname and xml schema type
        QName faultQName;
        XmlTypeInfo faultTypeInfo;
        if (part.getElementName() != null) {
            XmlElementInfo elementInfo = schemaInfo.elements.get(part.getElementName());
            if (elementInfo == null) {
                throw new OpenEJBException("Can not find element: " + part.getElementName() + ", known elements: " + schemaInfo.elements.keySet());
            }
            faultTypeInfo = schemaInfo.types.get(elementInfo.xmlType);
            if (faultTypeInfo == null) {
                throw new OpenEJBException("Can not find type " + elementInfo.xmlType + " for element " + elementInfo.qname + ", known types: " + schemaInfo.types.keySet());
            }

            faultQName = part.getElementName();
        } else if (part.getTypeName() != null) {
            faultTypeInfo = schemaInfo.types.get(part.getTypeName());
            if (faultTypeInfo == null) {
                throw new OpenEJBException("Can not find type: " + part.getTypeName() + ", known elements: " + schemaInfo.types.keySet());
            }

            faultQName = new QName("", fault.getName());
        } else {
            throw new OpenEJBException("Neither type nor element name supplied for part: " + part);
        }

        //
        // Build the fault info
        //
        JaxRpcFaultInfo faultInfo = new JaxRpcFaultInfo();
        faultInfo.qname = faultQName;
        faultInfo.xmlType = faultTypeInfo.qname;
        faultInfo.javaType = exceptionMapping.getExceptionType();
        faultInfo.complex = faultTypeInfo.simpleBaseType == null;

        //
        // Map exception class constructor args
        //
        if (exceptionMapping.getConstructorParameterOrder() != null) {
            if (faultTypeInfo.simpleBaseType != null) {
                throw new OpenEJBException("ConstructorParameterOrder can only be set for complex types, not " + faultTypeInfo.qname);
            }

            Map<String, XmlElementInfo> elements = new HashMap<String, XmlElementInfo>();
            for (XmlElementInfo element : faultTypeInfo.elements.values()) {
                elements.put(element.qname.getLocalPart(), element);
            }

            ConstructorParameterOrder constructorParameterOrder = exceptionMapping.getConstructorParameterOrder();
            for (int i = 0; i < constructorParameterOrder.getElementName().size(); i++) {
                String paramName = constructorParameterOrder.getElementName().get(i);

                // get the parameter element
                XmlElementInfo paramElementInfo = elements.get(paramName);
View Full Code Here

Examples of org.jboss.seam.rest.exceptions.ExceptionMapping

                addExceptionMapping(mapping);
            }
        }

        // also, single @DeclarativeExceptionMapping can be used
        ExceptionMapping mapping = type.getAnnotation(ExceptionMapping.class);
        if (mapping != null) {
            addExceptionMapping(mapping);
        }
    }
View Full Code Here

Examples of org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping

               String exceptionType = getJavaTypeAsString(null, xmlType, xt.getNamespace(), false, true);

               if (registeredExceptions.contains(exceptionType) == false)
               {
                  registeredExceptions.add(exceptionType);
                  ExceptionMapping exceptionMapping = new ExceptionMapping(jwm);
                  exceptionMapping.setExceptionType(exceptionType);
                  exceptionMapping.setWsdlMessage(fault.getName());
                  jwm.addExceptionMappings(exceptionMapping);
               }
            }

            WSDLBindingOperation bindingOperation = HeaderUtil.getWSDLBindingOperation(wsdlDefinitions, op);
View Full Code Here

Examples of org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping

            if (mappedExceptions.contains(javaTypeName))
               continue;

            mappedExceptions.add(javaTypeName);

            ExceptionMapping mapping = new ExceptionMapping(javaWsdlMapping);

            mapping.setExceptionType(javaTypeName);
            QName name = new QName(wsdl.getTargetNamespace(), fmd.getXmlName().getLocalPart());
            mapping.setWsdlMessage(name);

            // Variable mappings generated from SchemaTypesCreater have their order preserved
            for (VariableMapping variableMapping : typeMapping.getVariableMappings())
               mapping.addConstructorParameter(variableMapping.getXmlElementName());

            javaWsdlMapping.addExceptionMappings(mapping);
         }
      }
View Full Code Here

Examples of org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping

               String exceptionType = getJavaTypeAsString(null, xmlType, false, true);

               if (registeredExceptions.contains(exceptionType) == false)
               {
                  registeredExceptions.add(exceptionType);
                  ExceptionMapping exceptionMapping = new ExceptionMapping(jwm);
                  exceptionMapping.setExceptionType(exceptionType);
                  exceptionMapping.setWsdlMessage(fault.getName());
                  jwm.addExceptionMappings(exceptionMapping);
               }
            }

            WSDLBindingOperation bindingOperation = HeaderUtil.getWSDLBindingOperation(wsdlDefinitions, op);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.