Package org.jboss.metadata.web.spec

Examples of org.jboss.metadata.web.spec.TldMetaData


    private TldMetaData parseTLD(VirtualFile tld)
    throws DeploymentUnitProcessingException {
        if (IMPLICIT_TLD.equals(tld.getName())) {
            // Implicit TLDs are different from regular TLDs
            return new TldMetaData();
        }
        InputStream is = null;
        try {
            is = tld.openStream();
            final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
View Full Code Here


        try {
            ModuleClassLoader jstl = Module.getModuleFromCallerModuleLoader(ModuleIdentifier.create("javax.servlet.jstl.api")).getClassLoader();
            for (String tld : JSTL_TAGLIBS) {
                InputStream is = jstl.getResourceAsStream("META-INF/" + tld);
                if (is != null) {
                    TldMetaData tldMetaData = parseTLD(tld, is);
                    jstlTlds.add(tldMetaData);
                }
            }
        } catch (ModuleLoadException e) {
            // Ignore
View Full Code Here

            ModuleClassLoader jstl = Module.getModuleFromCallerModuleLoader(ModuleIdentifier.create("org.gatein.pc"))
                    .getClassLoader();
            for (String tld : PORTLET_TLDS) {
                InputStream is = jstl.getResourceAsStream("META-INF/" + tld);
                if (is != null) {
                    TldMetaData tldMetaData = parseTLD(tld, is);
                    tlds.add(tldMetaData);
                }
            }
        } catch (ModuleLoadException e) {
            // Ignore
View Full Code Here

    private TldMetaData parseTLD(VirtualFile tld)
    throws DeploymentUnitProcessingException {
        if (IMPLICIT_TLD.equals(tld.getName())) {
            // Implicit TLDs are different from regular TLDs
            return new TldMetaData();
        }
        InputStream is = null;
        try {
            is = tld.openStream();
            final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
View Full Code Here

        }
        if (version == null) {
            // It is likely an error to not have a version at this point though
            version = Version.TLD_2_1;
        }
        TldMetaData tld = null;
        switch (version) {
            case TLD_1_1: tld = new Tld11MetaData(); break;
            case TLD_1_2: tld = new Tld12MetaData(); break;
            case TLD_2_0: tld = new Tld20MetaData(); break;
            case TLD_2_1: tld = new Tld21MetaData(); break;
        }

        // Handle attributes
        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i ++) {
            final String value = reader.getAttributeValue(i);
            if (reader.getAttributeNamespace(i) != null) {
                continue;
            }
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case ID: {
                    tld.setId(value);
                    break;
                }
                case VERSION: {
                    tld.setVersion(value);
                    break;
                }
                default: throw unexpectedAttribute(reader, i);
            }
        }

        DescriptionGroupMetaData descriptionGroup = new DescriptionGroupMetaData();
        // Handle elements
        while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
            if (DescriptionGroupMetaDataParser.parse(reader, descriptionGroup)) {
                if (tld.getDescriptionGroup() == null) {
                    tld.setDescriptionGroup(descriptionGroup);
                }
                continue;
            }
            final Element element = Element.forName(reader.getLocalName());
            switch (element) {
                case TLIB_VERSION:
                    tld.setTlibVersion(reader.getElementText());
                    break;
                case TLIBVERSION:
                    if (version == Version.TLD_1_1) {
                        tld.setTlibVersion(reader.getElementText());
                    } else {
                        throw unexpectedElement(reader);
                    }
                    break;
                case SHORT_NAME:
                    tld.setShortName(reader.getElementText());
                    break;
                case SHORTNAME:
                    if (version == Version.TLD_1_1) {
                        tld.setShortName(reader.getElementText());
                    } else {
                        throw unexpectedElement(reader);
                    }
                    break;
                case JSPVERSION:
                    if (version == Version.TLD_1_1) {
                        tld.setJspVersion(reader.getElementText());
                    } else {
                        throw unexpectedElement(reader);
                    }
                    break;
                case JSP_VERSION:
                    if (version == Version.TLD_1_2) {
                        tld.setJspVersion(reader.getElementText());
                    } else if (version != Version.TLD_1_1) {
                        // This is not valid, but still being used in 2.0+ TLDs
                        tld.setJspVersion(reader.getElementText());
                    } else {
                        throw unexpectedElement(reader);
                    }
                    break;
                case INFO:
                    if (version == Version.TLD_1_1) {
                        ((Tld11MetaData) tld).setInfo(reader.getElementText());
                    } else {
                        throw unexpectedElement(reader);
                    }
                    break;
                case URI:
                    tld.setUri(reader.getElementText());
                    break;
                case VALIDATOR:
                    tld.setValidator(ValidatorMetaDataParser.parse(reader));
                    break;
                case LISTENER:
                    List<ListenerMetaData> listeners = tld.getListeners();
                    if (listeners == null) {
                        listeners = new ArrayList<ListenerMetaData>();
                        tld.setListeners(listeners);
                    }
                    listeners.add(ListenerMetaDataParser.parse(reader));
                    break;
                case TAG:
                    List<TagMetaData> tags = tld.getTags();
                    if (tags == null) {
                        tags = new ArrayList<TagMetaData>();
                        tld.setTags(tags);
                    }
                    tags.add(TagMetaDataParser.parse(reader, version));
                    break;
                case TAG_FILE:
                    List<TagFileMetaData> tagfiles = tld.getTagFiles();
                    if (tagfiles == null) {
                        tagfiles = new ArrayList<TagFileMetaData>();
                        tld.setTagFiles(tagfiles);
                    }
                    tagfiles.add(TagFileMetaDataParser.parse(reader));
                    break;
                case FUNCTION:
                    List<FunctionMetaData> functions = tld.getFunctions();
                    if (functions == null) {
                        functions = new ArrayList<FunctionMetaData>();
                        tld.setFunctions(functions);
                    }
                    functions.add(FunctionMetaDataParser.parse(reader));
                    break;
                case TAGLIB_EXTENSION:
                    List<TldExtensionMetaData> extensions = tld.getTaglibExtensions();
                    if (extensions == null) {
                        extensions = new ArrayList<TldExtensionMetaData>();
                        tld.setTaglibExtensions(extensions);
                    }
                    extensions.add(TldExtensionMetaDataParser.parse(reader));
                    break;
               default: throw unexpectedElement(reader);
            }
View Full Code Here

    private TldMetaData parseTLD(VirtualFile tld)
    throws DeploymentUnitProcessingException {
        if (IMPLICIT_TLD.equals(tld.getName())) {
            // Implicit TLDs are different from regular TLDs
            return new TldMetaData();
        }
        InputStream is = null;
        try {
            is = tld.openStream();
            final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
View Full Code Here

TOP

Related Classes of org.jboss.metadata.web.spec.TldMetaData

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.