/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.muse.ws.notification.impl;
import org.w3c.dom.Element;
import org.apache.muse.core.routing.AbstractMessageHandler;
import org.apache.muse.core.serializer.Serializer;
import org.apache.muse.core.serializer.SerializerRegistry;
import org.apache.muse.util.xml.XmlUtils;
import org.apache.muse.ws.addressing.soap.SoapFault;
import org.apache.muse.ws.notification.NotificationMessage;
import org.apache.muse.ws.notification.WsnConstants;
/**
*
* NotifyHandler is the parser for the WS-Notification Notify operation.
*
* @author Dan Jemiolo (danj)
*
*/
public class NotifyHandler extends AbstractMessageHandler
{
//
// Response message never changes, so we use a static value
//
private static final Element _NOTIFY_RESPONSE = XmlUtils.createElement(WsnConstants.NOTIFY_RESPONSE_QNAME);
public NotifyHandler()
{
super(WsnConstants.NOTIFY_URI, WsnConstants.NOTIFY_QNAME);
}
public Object[] fromXML(Element xml)
throws SoapFault
{
//
// use the Muse serializer framework to convert <Notify/> into
// an array of NotificationMessage objects
//
SerializerRegistry registry = SerializerRegistry.getInstance();
Serializer ser = registry.getSerializer(NotificationMessage[].class);
Object messageArray = ser.fromXML(xml);
return new Object[]{ messageArray };
}
public Element toXML(Object result)
{
return _NOTIFY_RESPONSE;
}
}