Package xdoclet

Examples of xdoclet.XDocletException


    public void ifIsNotInterfaceMethod(String template, Properties attributes) throws XDocletException
    {
        String intFace = attributes.getProperty("interface");

        if (intFace == null) {
            throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class, XDocletModulesEjbMessages.TAG_MISSING_INTERFACE_PARAMETER, new String[]{"<XDtEjbIntf:ifIsNotInterfaceMethod>"}));
        }

        if (!isInterfaceMethod(intFace)) {
            generate(template);
        }
View Full Code Here


        String intf_view_type = attributes.getProperty("interface");
        String superclasses_str = attributes.getProperty("superclasses");
        boolean superclasses = TypeConversionUtil.stringToBoolean(superclasses_str, true);

        if (intf_view_type == null) {
            throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class, XDocletModulesEjbMessages.TAG_MISSING_INTERFACE_PARAMETER, new String[]{"<XDtEjbIntf:ifIsInterfaceMethod>"}));
        }

        if (isInterfaceMethod(intf_view_type)) {
            boolean currentMethodDoesntBelongsToCurrentClass = !getCurrentMethod().getContainingClass().equals(getCurrentClass());
View Full Code Here

        }

        String bean_class_name = getBeanClassNameFromInterfaceNameFor(return_type);

        if (bean_class_name == null) {
            throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class, XDocletModulesEjbMessages.INTERFACE_IMPL_NOT_FOUND, new String[]{return_type}));
        }

        return bean_class_name;
    }
View Full Code Here

                if (relationTag != null) {
                    String relationName = relationTag.getAttributeValue("name");

                    if (relationName == null) {
                        throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class, XDocletModulesEjbMessages.RELATION_MUST_HAVE_NAME, new String[]{getCurrentClass().getName()}));
                    }

                    RelationHolder relationHolder = (RelationHolder) relationMap.get(relationName);

                    if (relationHolder != null && relationHolder.getLeft() != null && relationHolder.getRight() != null) {
                        String leftSignature = relationHolder.getLeftMethod().getContainingClass().getQualifiedName() + "." + relationHolder.getLeftMethod();
                        String rightSignature = relationHolder.getRightMethod().getContainingClass().getQualifiedName() + "." + relationHolder.getRightMethod();
                        String currentSignature = method.getContainingClass().getQualifiedName() + "." + method;

                        throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class, XDocletModulesEjbMessages.RELATION_TOO_MANY_NAMES, new String[]{
                            relationName,
                            leftSignature,
                            rightSignature,
                            currentSignature
                            }));
View Full Code Here

            }
            cur_clazz = cur_clazz.getSuperclass();
        } while (cur_clazz != null);

        if (currentDataClass == null) {
            throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class, XDocletModulesEjbMessages.DATACLASS_NOT_FOUND));
        }
        return currentDataClass;
    }
View Full Code Here

    public String dataObjectClassNameFromInterfaceName() throws XDocletException
    {
        String return_type = MethodTagsHandler.getMethodTypeFor(getCurrentMethod());

        if (return_type == null) {
            throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class, XDocletModulesEjbMessages.INTERFACE_NOT_FOUND, new String[]{getCurrentMethod().getName()}));
        }

        String bean_class_name = InterfaceTagsHandler.getBeanClassNameFromInterfaceNameFor(return_type);

        if (bean_class_name == null) {
            throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class, XDocletModulesEjbMessages.INTERFACE_IMPL_NOT_FOUND, new String[]{return_type}));
        }

        XClass bean_class = getXJavaDoc().getXClass(bean_class_name);

        if (bean_class == null) {
            throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class, XDocletModulesEjbMessages.INTERFACE_IMPL_COULDNT_LOAD, new String[]{return_type}));
        }

        String dataobject_class_name = DataObjectTagsHandler.getDataObjectClassFor(bean_class);

        if (dataobject_class_name == null) {
            throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class, XDocletModulesEjbMessages.INTERFACE_DATAOBJECT_NOT_KNOWN, new String[]{return_type}));
        }

        return dataobject_class_name;
    }
View Full Code Here

            db.setErrorHandler(error);
            doc = db.parse(uri);
            return doc;
        }catch (ParserConfigurationException e){
            e.printStackTrace();
            throw new XDocletException("Parser Config Error");
        }catch (SAXParseException e){
            e.printStackTrace();
            throw new XDocletException("Parsing Error in "+uri+" at line "+e.getLineNumber());
        }catch (SAXException e){
            e.printStackTrace();
            throw new XDocletException("Parsing Error in "+uri);
        }catch (IOException e){
            if (e instanceof FileNotFoundException)
                throw (FileNotFoundException)e;
            e.printStackTrace();
            throw new XDocletException("IO Error in "+uri);
        }
    }
View Full Code Here

    public void validateOptions() throws XDocletException
    {
        super.validateOptions();

        if (getLocalClassPattern() == null || getLocalClassPattern().trim().equals("")) {
            throw new XDocletException(Translator.getString(XDocletMessages.class, XDocletMessages.PARAMETER_MISSING_OR_EMPTY, new String[]{"pattern"}));
        }

        if (getLocalClassPattern().indexOf("{0}") == -1) {
            throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class, XDocletModulesEjbMessages.PATTERN_HAS_NO_PLACEHOLDER));
        }
    }
View Full Code Here

            for (Iterator i = clazz.getDoc().getTags(tag.getName()).iterator(); i.hasNext(); ) {
                if (tag.equals(i.next())) {
                    // ok, we are defined here return defined ejb name
                    name = EjbTagsHandler.getShortEjbNameFor(clazz);
                    if (name == null) {
                        throw new XDocletException("unable to determine value object name in class " + clazz.getName());
                    }
                    return name;
                }
            }
            // not found on current level. try with superclass
            clazz = clazz.getSuperclass();
        }
        throw new XDocletException("class defining value object is not EJB");
    }
View Full Code Here

        if (concreteType != null) {
            try {
                concreteClass = Class.forName(concreteType);
            }
            catch (ClassNotFoundException e) {
                throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class,
                    XDocletModulesEjbMessages.VALUE_OBJECT_CONCRETE_TYPE_NOT_FOUND,
                    new String[]{concreteType}));
            }
            if (concreteClass.isInterface()) {
                throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class,
                    XDocletModulesEjbMessages.VALUE_OBJECT_CONCRETE_TYPE_IS_INTF,
                    new String[]{concreteType}));
            }
            if (Modifier.isAbstract(concreteClass.getModifiers())) {
                throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class,
                    XDocletModulesEjbMessages.VALUE_OBJECT_CONCRETE_TYPE_IS_ABSTRACT,
                    new String[]{concreteType}));
            }
        }

        String currentReturnType = getCurrentMethod().getReturnType().getType().getQualifiedName();

        if (currentReturnType.equals("java.util.Collection")) {
            if (concreteClass == null) {
                return "java.util.ArrayList";
            }
            else {
                // verify that the concrete class is a Collection
                if (!Collection.class.isAssignableFrom(concreteClass)) {
                    throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class,
                        XDocletModulesEjbMessages.VALUE_OBJECT_CONCRETE_TYPE_INVALID,
                        new String[]{concreteType, "java.util.Collection"}));
                }
                return concreteType;
            }

        }
        else if (currentReturnType.equals("java.util.Set")) {
            if (concreteClass == null) {
                return "java.util.HashSet";
            }
            else {
                // verify that the concrete class is a Set
                if (!Set.class.isAssignableFrom(concreteClass)) {
                    throw new XDocletException(Translator.getString(XDocletModulesEjbMessages.class,
                        XDocletModulesEjbMessages.VALUE_OBJECT_CONCRETE_TYPE_INVALID,
                        new String[]{concreteType, "java.util.Set"}));
                }
                return concreteType;
            }
        }
        else {
            throw new XDocletException("Invalid return type (" +
                currentReturnType +
                " on aggregate or composition.");
        }
    }
View Full Code Here

TOP

Related Classes of xdoclet.XDocletException

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.