Package org.apache.cxf.tools.common.model

Examples of org.apache.cxf.tools.common.model.JavaExceptionClass


            Map<String, JavaExceptionClass> exceptionClasses = javaModel
                    .getExceptionClasses();
            for (Iterator iter = exceptionClasses.keySet().iterator(); iter
                    .hasNext();) {
                String expClassName = (String)iter.next();
                JavaExceptionClass expClz =
                    exceptionClasses.get(expClassName);
   
                clearAttributes();
               
                if (penv.containsKey(ToolConstants.CFG_FAULT_SERIAL_VERSION_UID)) {
                    String faultSerialVersionUID
                        = penv.get(ToolConstants.CFG_FAULT_SERIAL_VERSION_UID).toString();
                    setAttributes("faultSerialVersionUID", faultSerialVersionUID);
                    if ("FQCN".equalsIgnoreCase(faultSerialVersionUID)) {
                        setAttributes("suid", generateHashSUID(expClz.getFullClassName()));
                    } else if ("TIMESTAMP".equalsIgnoreCase(faultSerialVersionUID)) {
                        setAttributes("suid", generateTimestampSUID());
                    } else if ("NONE".equalsIgnoreCase(faultSerialVersionUID)) {
                        //nothing
                        setAttributes("suid", "");
                    } else {
                        //do a quick Parse to make sure it looks like a Long
                        try {
                            Long.parseLong(faultSerialVersionUID);
                        } catch (NumberFormatException nfe) {
                            throw new ToolException(nfe);
                        }
                        setAttributes("suid", faultSerialVersionUID);
                    }
                } else {
                    setAttributes("suid", "");
                }
                setAttributes("expClass", expClz);
                String exceptionSuperclass;
                if (penv.containsKey(ToolConstants.CFG_EXCEPTION_SUPER)) {
                    exceptionSuperclass = penv.get(ToolConstants.CFG_EXCEPTION_SUPER).toString();
                } else {
                    exceptionSuperclass = "java.lang.Exception";
                }
                String simpleName = exceptionSuperclass.indexOf('.') == -1 ? exceptionSuperclass
                    : exceptionSuperclass.substring(exceptionSuperclass.lastIndexOf('.') + 1);
                String exceptionSuperclassString = simpleName;
                for (JavaField jf : expClz.getFields()) {
                    String jfClassName = jf.getClassName();
                    if (jfClassName.substring(jfClassName.lastIndexOf(".") + 1)
                        .equals(simpleName)) {
                        exceptionSuperclassString = exceptionSuperclass;
                    }
                    setAttributes("paraName", ProcessorUtil.mangleNameToVariableName(jf.getName()));
                }
                ClassCollector collector = penv.get(ClassCollector.class);
                for (String pkg : collector.getTypesPackages()) {
                    if (collector.containTypesClass(pkg, simpleName)) {
                        exceptionSuperclassString = exceptionSuperclass;
                    }
                }
                if (expClz.getName().equals(exceptionSuperclassString)) {
                    exceptionSuperclassString = exceptionSuperclass;
                }
                setAttributes("exceptionSuperclass", exceptionSuperclassString);
                if (!exceptionSuperclass.startsWith("java.lang.")
                    && !exceptionSuperclassString.equals(exceptionSuperclass)) {
                    expClz.addImport(exceptionSuperclass);
                }
                setCommonAttributes();
                doWrite(FAULT_TEMPLATE, parseOutputName(expClz.getPackageName(),
                        expClz.getName()));
            }
        }
    }
View Full Code Here


            Map<String, JavaExceptionClass> exceptionClasses = javaModel
                    .getExceptionClasses();
            for (Iterator iter = exceptionClasses.keySet().iterator(); iter
                    .hasNext();) {
                String expClassName = (String)iter.next();
                JavaExceptionClass expClz =
                    exceptionClasses.get(expClassName);
   
                clearAttributes();
                if (penv.containsKey(ToolConstants.CFG_USE_FQCN_FAULT_SERIAL_VERSION_UID)) {
                    setAttributes("suid", generateHashSUID(expClz.getFullClassName()));
                } else {
                    setAttributes("suid", generateTimestampSUID());
                }
                setAttributes("expClass", expClz);
                for (JavaField jf : expClz.getFields()) {
                    setAttributes("paraName", ProcessorUtil.mangleNameToVariableName(jf.getName()));
                }
               
                String exceptionSuperclass = "Exception";
                if (expClz.getName().equals(exceptionSuperclass)) {
                    exceptionSuperclass = "java.lang.Exception";
                }
                setAttributes("exceptionSuperclass", exceptionSuperclass);

                setCommonAttributes();
                doWrite(FAULT_TEMPLATE, parseOutputName(expClz.getPackageName(),
                        expClz.getName()));
            }
        }
    }
View Full Code Here

            Map<String, JavaExceptionClass> exceptionClasses = javaModel
                    .getExceptionClasses();
            for (Iterator iter = exceptionClasses.keySet().iterator(); iter
                    .hasNext();) {
                String expClassName = (String)iter.next();
                JavaExceptionClass expClz =
                    exceptionClasses.get(expClassName);
   
                clearAttributes();
               
                if (penv.containsKey(ToolConstants.CFG_FAULT_SERIAL_VERSION_UID)) {
                    String faultSerialVersionUID
                        = penv.get(ToolConstants.CFG_FAULT_SERIAL_VERSION_UID).toString();
                    setAttributes("faultSerialVersionUID", faultSerialVersionUID);
                    if ("FQCN".equalsIgnoreCase(faultSerialVersionUID)) {
                        setAttributes("suid", generateHashSUID(expClz.getFullClassName()));
                    } else if ("TIMESTAMP".equalsIgnoreCase(faultSerialVersionUID)) {
                        setAttributes("suid", generateTimestampSUID());
                    } else if ("NONE".equalsIgnoreCase(faultSerialVersionUID)) {
                        //nothing
                        setAttributes("suid", "");
                    } else {
                        //do a quick Parse to make sure it looks like a Long
                        try {
                            Long.parseLong(faultSerialVersionUID);
                        } catch (NumberFormatException nfe) {
                            throw new ToolException(nfe);
                        }
                        setAttributes("suid", faultSerialVersionUID);
                    }
                } else {
                    setAttributes("suid", "");
                }
                setAttributes("expClass", expClz);
                String exceptionSuperclass = "Exception";
                for (JavaField jf : expClz.getFields()) {
                    String jfClassName = jf.getClassName();
                    if (jfClassName.substring(jfClassName.lastIndexOf(".") + 1).equals("Exception")) {
                        exceptionSuperclass = "java.lang.Exception";
                    }
                    setAttributes("paraName", ProcessorUtil.mangleNameToVariableName(jf.getName()));
                }
                ClassCollector collector = penv.get(ClassCollector.class);
                for (String pkg : collector.getTypesPackages()) {
                    if (collector.containTypesClass(pkg, "Exception")) {
                        exceptionSuperclass = "java.lang.Exception";
                    }
                }
                if (expClz.getName().equals(exceptionSuperclass)) {
                    exceptionSuperclass = "java.lang.Exception";
                }
                setAttributes("exceptionSuperclass", exceptionSuperclass);

                setCommonAttributes();
                doWrite(FAULT_TEMPLATE, parseOutputName(expClz.getPackageName(),
                        expClz.getName()));
            }
        }
    }
View Full Code Here

            Map<String, JavaExceptionClass> exceptionClasses = javaModel
                    .getExceptionClasses();
            for (Iterator iter = exceptionClasses.keySet().iterator(); iter
                    .hasNext();) {
                String expClassName = (String)iter.next();
                JavaExceptionClass expClz =
                    exceptionClasses.get(expClassName);
   
                clearAttributes();
                setAttributes("suid", getSUID());
                setAttributes("expClass", expClz);
                for (JavaField jf : expClz.getFields()) {
                    setAttributes("paraName", ProcessorUtil.mangleNameToVariableName(jf.getName()));
                }
                setCommonAttributes();
                doWrite(FAULT_TEMPLATE, parseOutputName(expClz.getPackageName(),
                        expClz.getName()));
            }
        }
    }
View Full Code Here

            Map<String, JavaExceptionClass> exceptionClasses = javaModel
                    .getExceptionClasses();
            for (Iterator iter = exceptionClasses.keySet().iterator(); iter
                    .hasNext();) {
                String expClassName = (String)iter.next();
                JavaExceptionClass expClz =
                    exceptionClasses.get(expClassName);
   
                clearAttributes();
               
                if (penv.containsKey(ToolConstants.CFG_FAULT_SERIAL_VERSION_UID)) {
                    String faultSerialVersionUID
                        = penv.get(ToolConstants.CFG_FAULT_SERIAL_VERSION_UID).toString();
                    setAttributes("faultSerialVersionUID", faultSerialVersionUID);
                    if ("FQCN".equalsIgnoreCase(faultSerialVersionUID)) {
                        setAttributes("suid", generateHashSUID(expClz.getFullClassName()));
                    } else if ("TIMESTAMP".equalsIgnoreCase(faultSerialVersionUID)) {
                        setAttributes("suid", generateTimestampSUID());
                    } else if ("NONE".equalsIgnoreCase(faultSerialVersionUID)) {
                        //nothing
                        setAttributes("suid", "");
                    } else {
                        //do a quick Parse to make sure it looks like a Long
                        try {
                            Long.parseLong(faultSerialVersionUID);
                        } catch (NumberFormatException nfe) {
                            throw new ToolException(nfe);
                        }
                        setAttributes("suid", faultSerialVersionUID);
                    }
                } else {
                    setAttributes("suid", "");
                }
                setAttributes("expClass", expClz);
                String exceptionSuperclass;
                if (penv.containsKey(ToolConstants.CFG_EXCEPTION_SUPER)) {
                    exceptionSuperclass = penv.get(ToolConstants.CFG_EXCEPTION_SUPER).toString();
                } else {
                    exceptionSuperclass = "java.lang.Exception";
                }
                String simpleName = exceptionSuperclass.indexOf('.') == -1 ? exceptionSuperclass
                    : exceptionSuperclass.substring(exceptionSuperclass.lastIndexOf('.') + 1);
                String exceptionSuperclassString = simpleName;
                for (JavaField jf : expClz.getFields()) {
                    String jfClassName = jf.getClassName();
                    if (jfClassName.substring(jfClassName.lastIndexOf(".") + 1)
                        .equals(simpleName)) {
                        exceptionSuperclassString = exceptionSuperclass;
                    }
                    setAttributes("paraName", ProcessorUtil.mangleNameToVariableName(jf.getName()));
                }
                ClassCollector collector = penv.get(ClassCollector.class);
                for (String pkg : collector.getTypesPackages()) {
                    if (collector.containTypesClass(pkg, simpleName)) {
                        exceptionSuperclassString = exceptionSuperclass;
                    }
                }
                if (expClz.getName().equals(exceptionSuperclassString)) {
                    exceptionSuperclassString = exceptionSuperclass;
                }
                setAttributes("exceptionSuperclass", exceptionSuperclassString);

                setCommonAttributes();
                doWrite(FAULT_TEMPLATE, parseOutputName(expClz.getPackageName(),
                        expClz.getName()));
            }
        }
    }
View Full Code Here

            Map<String, JavaExceptionClass> exceptionClasses = javaModel
                    .getExceptionClasses();
            for (Iterator iter = exceptionClasses.keySet().iterator(); iter
                    .hasNext();) {
                String expClassName = (String)iter.next();
                JavaExceptionClass expClz =
                    exceptionClasses.get(expClassName);
   
                clearAttributes();
                if (penv.containsKey(ToolConstants.CFG_USE_FQCN_FAULT_SERIAL_VERSION_UID)) {
                    setAttributes("suid", generateHashSUID(expClz.getFullClassName()));
                } else {
                    setAttributes("suid", generateTimestampSUID());
                }
                setAttributes("expClass", expClz);
                for (JavaField jf : expClz.getFields()) {
                    setAttributes("paraName", ProcessorUtil.mangleNameToVariableName(jf.getName()));
                }
                setCommonAttributes();
                doWrite(FAULT_TEMPLATE, parseOutputName(expClz.getPackageName(),
                        expClz.getName()));
            }
        }
    }
View Full Code Here

            Map<String, JavaExceptionClass> exceptionClasses = javaModel
                    .getExceptionClasses();
            for (Iterator iter = exceptionClasses.keySet().iterator(); iter
                    .hasNext();) {
                String expClassName = (String)iter.next();
                JavaExceptionClass expClz =
                    exceptionClasses.get(expClassName);
   
                clearAttributes();
                if (penv.containsKey(ToolConstants.CFG_USE_FQCN_FAULT_SERIAL_VERSION_UID)) {
                    setAttributes("suid", generateHashSUID(expClz.getFullClassName()));
                } else {
                    setAttributes("suid", generateTimestampSUID());
                }
                setAttributes("expClass", expClz);
                String exceptionSuperclass = "Exception";
                for (JavaField jf : expClz.getFields()) {
                    String jfClassName = jf.getClassName();
                    if (jfClassName.substring(jfClassName.lastIndexOf(".") + 1).equals("Exception")) {
                        exceptionSuperclass = "java.lang.Exception";
                    }
                    setAttributes("paraName", ProcessorUtil.mangleNameToVariableName(jf.getName()));
                }
                ClassCollector collector = penv.get(ClassCollector.class);
                for (String pkg : collector.getTypesPackages()) {
                    if (collector.containTypesClass(pkg, "Exception")) {
                        exceptionSuperclass = "java.lang.Exception";
                    }
                }
                if (expClz.getName().equals(exceptionSuperclass)) {
                    exceptionSuperclass = "java.lang.Exception";
                }
                setAttributes("exceptionSuperclass", exceptionSuperclass);

                setCommonAttributes();
                doWrite(FAULT_TEMPLATE, parseOutputName(expClz.getPackageName(),
                        expClz.getName()));
            }
        }
    }
View Full Code Here

            Map<String, JavaExceptionClass> exceptionClasses = javaModel
                    .getExceptionClasses();
            for (Iterator iter = exceptionClasses.keySet().iterator(); iter
                    .hasNext();) {
                String expClassName = (String)iter.next();
                JavaExceptionClass expClz =
                    exceptionClasses.get(expClassName);
   
                clearAttributes();
                if (penv.containsKey(ToolConstants.CFG_USE_FQCN_FAULT_SERIAL_VERSION_UID)) {
                    setAttributes("suid", generateHashSUID(expClz.getFullClassName()));
                } else {
                    setAttributes("suid", generateTimestampSUID());
                }
                setAttributes("expClass", expClz);
                String exceptionSuperclass = "Exception";
                for (JavaField jf : expClz.getFields()) {
                    String jfClassName = jf.getClassName();
                    if (jfClassName.substring(jfClassName.lastIndexOf(".") + 1).equals("Exception")) {
                        exceptionSuperclass = "java.lang.Exception";
                    }
                    setAttributes("paraName", ProcessorUtil.mangleNameToVariableName(jf.getName()));
                }
               
               
                if (expClz.getName().equals(exceptionSuperclass)) {
                    exceptionSuperclass = "java.lang.Exception";
                }
                setAttributes("exceptionSuperclass", exceptionSuperclass);

                setCommonAttributes();
                doWrite(FAULT_TEMPLATE, parseOutputName(expClz.getPackageName(),
                        expClz.getName()));
            }
        }
    }
View Full Code Here

        method.addException(new JavaException(faultMessage.getName().getLocalPart(),
                                              samePackage ? name : fullClassName, namespace));

        List<MessagePartInfo> faultParts = faultMessage.getMessageParts();

        JavaExceptionClass expClass = new JavaExceptionClass(model);
        expClass.setName(name);
        expClass.setNamespace(namespace);
        expClass.setPackageName(packageName);

        for (MessagePartInfo part : faultParts) {
            String fName = null;
            String fNamespace = null;

            if (part.getElementQName() != null) {
                fNamespace = part.getElementQName().getNamespaceURI();
                //fNamespace = part.getConcreteName().getNamespaceURI();
                fName = part.getConcreteName().getLocalPart();
            } else {
                fNamespace = part.getTypeQName().getNamespaceURI();
                fName = part.getConcreteName().getLocalPart();
            }

            if (StringUtils.isEmpty(fNamespace)) {
                fNamespace = namespace;
            }

            String fType = ProcessorUtil.getType(part, context, false);

            //REVISIT - custom JAXB package names
            String fPackageName = method.getInterface().getPackageName();


            JavaField fField = new JavaField(fName, fType, fNamespace);
            fField.setQName(ProcessorUtil.getElementName(part));

            if (!method.getInterface().getPackageName().equals(fPackageName)) {
                fField.setClassName(ProcessorUtil.getFullClzName(part, context, false));
            }
            if (!fType.equals(ProcessorUtil.resolvePartType(part))) {
                fField.setClassName(ProcessorUtil.getType(part, context, true));
            }

            expClass.addField(fField);
        }
        model.addExceptionClass(packageName + "." + name, expClass);
    }
View Full Code Here

        Map<String, JavaExceptionClass> exceptionClasses = javaModel
                .getExceptionClasses();
        for (Iterator iter = exceptionClasses.keySet().iterator(); iter
                .hasNext();) {
            String expClassName = (String)iter.next();
            JavaExceptionClass expClz =
                exceptionClasses.get(expClassName);

            clearAttributes();
            setAttributes("expClass", expClz);
            for (JavaField jf : expClz.getFields()) {
                setAttributes("paraName", ProcessorUtil.mangleNameToVariableName(jf.getName()));
            }
            setCommonAttributes();
            doWrite(FAULT_TEMPLATE, parseOutputName(expClz.getPackageName(),
                    expClz.getName()));
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.tools.common.model.JavaExceptionClass

Copyright © 2018 www.massapicom. 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.