Package org.jboss.metadata.web.spec

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


        // @WebListener
        final List<AnnotationInstance> webListenerAnnotations = index.getAnnotations(webListener);
        if (webListenerAnnotations != null && webListenerAnnotations.size() > 0) {
            List<ListenerMetaData> listeners = new ArrayList<ListenerMetaData>();
            for (final AnnotationInstance annotation : webListenerAnnotations) {
                ListenerMetaData listener = new ListenerMetaData();
                AnnotationTarget target = annotation.target();
                if (!(target instanceof ClassInfo)) {
                    throw new DeploymentUnitProcessingException("@Weblistener is only allowed at class level " + target);
                }
                ClassInfo classInfo = ClassInfo.class.cast(target);
                listener.setListenerClass(classInfo.toString());
                AnnotationValue descriptionValue = annotation.value();
                if (descriptionValue != null) {
                    DescriptionGroupMetaData descriptionGroup = getDescriptionGroup(descriptionValue.asString());
                    if (descriptionGroup != null) {
                        listener.setDescriptionGroup(descriptionGroup);
                    }
                }
                listeners.add(listener);
            }
            metaData.setListeners(listeners);
View Full Code Here


          contextParams = new ArrayList<ParamValueMetaData>();
          metadata.setContextParams(contextParams);
       }
       contextParams.add(createParameter("com.sun.faces.expressionFactory", "org.apache.el.ExpressionFactoryImpl"));

       ListenerMetaData jsfInitListener = new ListenerMetaData();
       jsfInitListener.setListenerClass("com.sun.faces.config.ConfigureListener");
       List<ListenerMetaData> listeners = metadata.getListeners();
       if (listeners == null) {
          listeners = new ArrayList<ListenerMetaData>();
          metadata.setListeners(listeners);
       }
View Full Code Here

* @author Remy Maucherat
*/
public class ListenerMetaDataParser extends MetaDataElementParser {

    public static ListenerMetaData parse(XMLStreamReader reader) throws XMLStreamException {
        ListenerMetaData listener = new ListenerMetaData();

        // 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: {
                    listener.setId(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 (listener.getDescriptionGroup() == null) {
                    listener.setDescriptionGroup(descriptionGroup);
                }
                continue;
            }
            final Element element = Element.forName(reader.getLocalName());
            switch (element) {
                case LISTENER_CLASS:
                    listener.setListenerClass(reader.getElementText());
                    break;
                default: throw unexpectedElement(reader);
            }
        }

View Full Code Here

* @author Remy Maucherat
*/
public class ListenerMetaDataParser extends MetaDataElementParser {

    public static ListenerMetaData parse(XMLStreamReader reader) throws XMLStreamException {
        ListenerMetaData listener = new ListenerMetaData();

        // 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: {
                    listener.setId(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 (listener.getDescriptionGroup() == null) {
                    listener.setDescriptionGroup(descriptionGroup);
                }
                continue;
            }
            final Element element = Element.forName(reader.getLocalName());
            switch (element) {
                case LISTENER_CLASS:
                    listener.setListenerClass(reader.getElementText());
                    break;
                default: throw unexpectedElement(reader);
            }
        }

View Full Code Here

TOP

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

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.