/** * @return The DAV event type representation for all known JCR event types. */ public static EventType[] getAllEventTypes() { EventType[] types = DefaultEventType.create(EventUtil.EVENT_ALL, NAMESPACE); return types; }
/** * Factory method to create a new <code>EventType</code>. * * @param localName * @param namespace * @return */ public static EventType create(String localName, Namespace namespace) { if (localName == null || "".equals(localName)) { throw new IllegalArgumentException("null and '' are not valid local names of an event type."); } String key = DomUtil.getQualifiedName(localName, namespace); if (eventTypes.containsKey(key)) { return (EventType) eventTypes.get(key); } else { EventType type = new DefaultEventType(localName, namespace); eventTypes.put(key, type); return type; } }
eventTypes = DefaultEventType.createFromXml(el); if (eventTypes.length == 0) { log.warn("'subscriptioninfo' must at least indicate a single, valid event type.");
eventTypes = DefaultEventType.createFromXml(el); if (eventTypes.length == 0) { log.warn("'subscriptioninfo' must at least indicate a single, valid event type.");
/** * Factory method to create an array of new <code>EventType</code> for the * specified localNames and the specified namespace. * * @param localNames * @param namespace * @return An array of event types. */ public static EventType[] create(String[] localNames, Namespace namespace) { EventType[] types = new EventType[localNames.length]; for (int i = 0; i < localNames.length; i++) { types[i] = create(localNames[i], namespace); } return types; }
eventTypes = DefaultEventType.createFromXml(el); if (eventTypes.length == 0) { log.warn("'subscriptioninfo' must at least indicate a single, valid event type.");
/** * Factory method to create a new <code>EventType</code>. * * @param localName * @param namespace * @return */ public static EventType create(String localName, Namespace namespace) { if (localName == null || "".equals(localName)) { throw new IllegalArgumentException("null and '' are not valid local names of an event type."); } String key = DomUtil.getExpandedName(localName, namespace); if (eventTypes.containsKey(key)) { return eventTypes.get(key); } else { EventType type = new DefaultEventType(localName, namespace); eventTypes.put(key, type); return type; } }
/** * Factory method to create an array of new <code>EventType</code> for the * specified localNames and the specified namespace. * * @param localNames * @param namespace * @return An array of event types. */ public static EventType[] create(String[] localNames, Namespace namespace) { EventType[] types = new EventType[localNames.length]; for (int i = 0; i < localNames.length; i++) { types[i] = create(localNames[i], namespace); } return types; }
Element evElem = eventElementIterator.nextElement(); Element typeEl = DomUtil.getChildElement(evElem, ObservationConstants.N_EVENTTYPE); EventType[] et = DefaultEventType.createFromXml(typeEl); if (et.length == 0 || et.length > 1) {
/** * Factory method to create a new <code>EventType</code>. * * @param localName * @param namespace * @return */ public static EventType create(String localName, Namespace namespace) { if (localName == null || "".equals(localName)) { throw new IllegalArgumentException("null and '' are not valid local names of an event type."); } String key = DomUtil.getExpandedName(localName, namespace); if (eventTypes.containsKey(key)) { return eventTypes.get(key); } else { EventType type = new DefaultEventType(localName, namespace); eventTypes.put(key, type); return type; } }
/** * Static utility method to convert the type defined by a * {@link javax.jcr.observation.Event JCR event} into an <code>EventType</code> * object. * * @param jcrEventType * @return <code>EventType</code> representation of the given JCR event type. * @throws IllegalArgumentException if the given int does not represent a * valid type constants as defined by {@link Event}.<br> * Valid values are * <ul> * <li>{@link Event#NODE_ADDED}</li> * <li>{@link Event#NODE_REMOVED}</li> * <li>{@link Event#PROPERTY_ADDED}</li> * <li>{@link Event#PROPERTY_REMOVED}</li> * <li>{@link Event#PROPERTY_CHANGED}</li> * <li>{@link Event#NODE_MOVED}</li> * <li>{@link Event#PERSIST}</li> * </ul> */ public static EventType getEventType(int jcrEventType) { String localName = EventUtil.getEventName(jcrEventType); return DefaultEventType.create(localName, NAMESPACE); }
Element evElem = eventElementIterator.nextElement(); Element typeEl = DomUtil.getChildElement(evElem, ObservationConstants.N_EVENTTYPE); EventType[] et = DefaultEventType.createFromXml(typeEl); if (et.length == 0 || et.length > 1) {
/** * Retrieves one or multiple <code>EventType</code>s from the 'eventtype' * Xml element. While a subscription may register multiple types (thus * the 'eventtype' contains multiple child elements), a single event may only * refer to one single type. * * @param eventType * @return */ public static EventType[] createFromXml(Element eventType) { if (!DomUtil.matches(eventType, ObservationConstants.XML_EVENTTYPE, ObservationConstants.NAMESPACE)) { throw new IllegalArgumentException("'eventtype' element expected which contains a least a single child element."); } List<EventType> etypes = new ArrayList<EventType>(); ElementIterator it = DomUtil.getChildren(eventType); while (it.hasNext()) { Element el = it.nextElement(); etypes.add(create(el.getLocalName(), DomUtil.getNamespace(el))); } return etypes.toArray(new EventType[etypes.size()]); }
/** * Retrieves one or multiple <code>EventType</code>s from the 'eventtype' * Xml element. While a subscription may register multiple types (thus * the 'eventtype' contains multiple child elements), a single event may only * refer to one single type. * * @param eventType * @return */ public static EventType[] createFromXml(Element eventType) { if (!DomUtil.matches(eventType, ObservationConstants.XML_EVENTTYPE, ObservationConstants.NAMESPACE)) { throw new IllegalArgumentException("'eventtype' element expected which contains a least a single child element."); } List<EventType> etypes = new ArrayList<EventType>(); ElementIterator it = DomUtil.getChildren(eventType); while (it.hasNext()) { Element el = it.nextElement(); etypes.add(create(el.getLocalName(), DomUtil.getNamespace(el))); } return etypes.toArray(new EventType[etypes.size()]); }
/** * Retrieves one or multiple <code>EventType</code>s from the 'eventtype' * Xml element. While a subscription may register multiple types (thus * the 'eventtype' contains multiple child elements), a single event may only * refer to one single type. * * @param eventType * @return */ public static EventType[] createFromXml(Element eventType) { if (!DomUtil.matches(eventType, ObservationConstants.XML_EVENTTYPE, ObservationConstants.NAMESPACE)) { throw new IllegalArgumentException("'eventtype' element expected which contains a least a single child element."); } List etypes = new ArrayList(); ElementIterator it = DomUtil.getChildren(eventType); while (it.hasNext()) { Element el = it.nextElement(); etypes.add(create(el.getLocalName(), DomUtil.getNamespace(el))); } return (EventType[]) etypes.toArray(new EventType[etypes.size()]); }