Package com.thoughtworks.qdox.model

Examples of com.thoughtworks.qdox.model.JavaClass


        private final Log log = LogFactory.getLog(EjbBeanResolverImpl.class);
        private Map ejbCache = new HashMap();

        public EjbBeanResolverImpl(Collection metadata) {
            for (Iterator iter = metadata.iterator(); iter.hasNext();) {
                JavaClass javaClass = (JavaClass) iter.next();

                if (isEJB(javaClass)) {
                    String ejbName = getEjbName(javaClass);

                    if (ejbCache.containsKey(ejbName)) {
                        JavaClass otherClass = (JavaClass) ejbCache.get(ejbName);
                        String errorMsg = "We cannot have two diferent ejb with same name: " +
                            javaClass.getFullyQualifiedName() + " and " + otherClass.getFullyQualifiedName();
                        log.error(errorMsg);
                        throw new Error(errorMsg);
                    } else {
                        ejbCache.put(ejbName, javaClass);
                    }
View Full Code Here


            return prop;
        }
    }

    private JavaClass findBeanByInterface(Collection metadata, Type type) {
        JavaClass retVal = null;
        LocalInterfacePlugin localPlugin = EjbRuntime.getLocalInterfacePlugin();
        RemoteInterfacePlugin remotePlugin = EjbRuntime.getRemoteInterfacePlugin();

        if (log.isDebugEnabled()) {
            log.debug("Looking for bean with local|remote interface named " + type);
        }

        for (Iterator iter = metadata.iterator(); retVal == null && iter.hasNext();) {
            JavaClass javaClass = (JavaClass) iter.next();
            Type localType = localPlugin.getVirtualType(javaClass).getType();
            Type remoteType = remotePlugin.getVirtualType(javaClass).getType();

            if (localType.equals(type) || remoteType.equals(type)) {
                if (log.isDebugEnabled()) {
                    log.debug("Match found for " + javaClass.getFullyQualifiedName());
                    log.debug("Local Interface " + localType);
                    log.debug("Remote Interface " + remoteType);
                }

                retVal = javaClass;
View Full Code Here

                            if ((relation != null) ||
                                    ((vTag != null) && ((vTag.getAggregate() != null) || (vTag.getCompose() != null)))) {
                                // This is a value-object relation
                                // vTag must be non-null, because we need values from it
                                if ((vTag != null) && ((vTag.getAggregate() != null) ^ (vTag.getCompose() != null))) {
                                    JavaClass relationEjb = null;
                                    Type collectionType = null;

                                    if (relation != null) {
                                        if (!method.equals(relation.getLeftMethod())) {
                                            log.debug(
View Full Code Here

        DocletTag[] valueTags = javaClass.getTagsByName(TagLibrary.EJB_VALUE_OBJECT);
        int countTags;

        if ((countTags = valueTags.length) > 0) {
            for (int i = 0; i < countTags; i++) {
                JavaClass newClass = new DuplicatedJavaClass(javaClass);
                DocletTag[] tags = newClass.getTags();
                List newTags = new ArrayList();
                int tagIdx = 0;

                for (int j = 0; j < tags.length; j++) {
                    DocletTag tag = tags[j];

                    if (TagLibrary.EJB_VALUE_OBJECT.equals(tag.getName())) {
                        if (tagIdx++ == i) {
                            newTags.add(tag);
                        }
                    } else {
                        newTags.add(tag);
                    }
                }

                // Set class tags
                newClass.setTags(newTags);

                // -----------------------------------------------------------------------
                // We'll validate at 'QDoxValueObjectExpanderFilterMetadataProvider' if we
                // have overlapping value objects
                // -----------------------------------------------------------------------
View Full Code Here

    public void setFileregex(String fileregex) {
        throw new RuntimeException("Can't set fileregex for plugin. Try setting it in " + EjbConfig.class.getName());
    }

    public boolean shouldGenerate(Object metadata) {
        JavaClass javaClass = (JavaClass) metadata;
        boolean generate = ejbUtils.shouldGenerate(javaClass);
        generate = generate && ejbUtils.isEntityBean(javaClass);
        generate = generate && (getMetaVO(javaClass) != null);
        if (generate) generate = isDestinationDirty(javaClass);
        if (generate && verbose) System.out.println(
                "Generating Value Object for " + javaClass.getName());
        return generate;
    }
View Full Code Here

     *
     * @see org.jibx.binding.model.IClass#getJavaDoc()
     */
    public String getJavaDoc() {
        IClassSourceLocator loc = (IClassSourceLocator)getLocator();
        JavaClass jc = loc.getSourceInfo(getClassFile().getName());
        if (jc != null) {
            String text = jc.getComment();
            if (text != null) {
                text = text.trim();
                if (text.length() > 0) {
                    return text;
                }
View Full Code Here

     * @param metadata TODO: DOCUMENT ME!
     *
     * @return TODO: DOCUMENT ME!
     */
    public boolean shouldGenerate(Object metadata) {
        JavaClass javaClass = (JavaClass) metadata;
        boolean generate = ejbUtils.shouldGenerate(metadata);
        generate = generate && EjbUtils.hasFlag(ejbUtils.getViewType(javaClass), EjbUtils.LOCAL);
        generate = generate && !ejbUtils.isMessageDrivenBean(javaClass);
        return generate;
    }
View Full Code Here

            return null;
        }

        JavaField field;
        JavaMethod method;
        JavaClass retVal = createDynamicJavaClass(getDestinationClassname(metadata), getDestinationPackage(metadata), null, getMetadataProvider());
        retVal.setInterface(true);
        retVal.setModifiers(new String[]{"public"});
        String[] extendz = getExtends(metadata);
        Type[] extendzTypes = new Type[extendz.length];
        for (int j = 0; j < extendz.length; j++) {
            extendzTypes[j] = new Type(extendz[j]);
        }
        retVal.setImplementz(extendzTypes);

        field = new JavaField(new Type("java.lang.String"), ejbHomeUtils.getCompleteNameConst());
        field.setModifiers(new String[]{"public","static","final"});
        retVal.addField(field);

        field = new JavaField(new Type("java.lang.String"), ejbHomeUtils.getJndiNameConst());
        field.setModifiers(new String[]{"public","static","final"});
        retVal.addField(field);

        Collection methods = getCreateMethods(metadata);
        for (Iterator iter = methods.iterator(); iter.hasNext();) {
            method = new DuplicatedJavaMethod((JavaMethod)iter.next());
            method.setModifiers(new String[0]);
            retVal.addMethod(method);
        }

        if (ejbUtils.isEntityBean(metadata)) {
            methods = getFinderMethods(metadata);
            for (Iterator iter = methods.iterator(); iter.hasNext();) {
                method = new DuplicatedJavaMethod((JavaMethod)iter.next());
                method.setModifiers(new String[0]);
                retVal.addMethod(method);
            }
        }
        methods = getHomeMethods(metadata);
        for (Iterator iter = methods.iterator(); iter.hasNext();) {
            method = new DuplicatedJavaMethod((JavaMethod)iter.next());
            method.setModifiers(new String[0]);
            retVal.addMethod(method);
        }

        return new JavaClass[]{retVal};
    }
View Full Code Here

    public String jndiName(JavaClass clazz) {
        return ejbUtils.getJndiName(clazz, EjbUtils.REMOTE);
    }

    public boolean shouldGenerate(Object metadata) {
        JavaClass javaClass = (JavaClass) metadata;
        EjbHomeTag homeTag = (EjbHomeTag) javaClass.getTagByName(TagLibrary.EJB_HOME);
        boolean generate = super.shouldGenerate(metadata);
        generate = generate && ((homeTag == null) || Arrays.asList(homeTag.getGenerate()).contains("remote"));
        if (generate) generate = isDestinationDirty(javaClass);
        if (generate && verbose) System.out.println(
                "Generating Remote Home Interface for " + javaClass.getName());
        return generate;
    }
View Full Code Here

            WriterMapper writerMapper, EjbConfig config) {
        super(templateEngine, writerMapper, config);
    }

    public boolean shouldGenerate(Object metadata) {
        JavaClass javaClass = (JavaClass) metadata;
        boolean generate = ejbUtils.shouldGenerate(metadata);
        generate = generate && EjbUtils.hasFlag(ejbUtils.getViewType(javaClass), EjbUtils.REMOTE);
        generate = generate && !ejbUtils.isMessageDrivenBean(javaClass);
        return generate;
    }
View Full Code Here

TOP

Related Classes of com.thoughtworks.qdox.model.JavaClass

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.