Package org.apache.muse.ws.resource.properties.get.impl

Source Code of org.apache.muse.ws.resource.properties.get.impl.GetRequest

/*=============================================================================*
*  Copyright 2006 The Apache Software Foundation
*
*  Licensed 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.resource.properties.get.impl;

import javax.xml.namespace.QName;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import org.apache.muse.util.messages.Messages;
import org.apache.muse.util.messages.MessagesFactory;
import org.apache.muse.ws.resource.ext.faults.InvalidMessageFormatFault;
import org.apache.muse.ws.resource.properties.WsrpConstants;
import org.apache.muse.util.xml.XmlSerializable;
import org.apache.muse.util.xml.XmlUtils;

/**
*
* GetRequest is a serializer/deserializer for the WS-ResourceProperties
* GetResourceProperty operation's request content.
*
* @author Dan Jemiolo (danj)
*
*/

public class GetRequest implements XmlSerializable
{
    //
    // Used to lookup all exception messages
    //
    private static Messages _MESSAGES = MessagesFactory.get(GetRequest.class);
   
    //
    // The name of the property to retrieve
    //
    private QName _qname = null;
   
    public GetRequest(Element request)
        throws InvalidMessageFormatFault
    {
        if (request == null)
            throw new NullPointerException(_MESSAGES.get("NullRequestElement"));
       
        _qname = XmlUtils.getQName(request);
       
        if (_qname == null)
            throw new InvalidMessageFormatFault(_MESSAGES.get("NullGetProperty"));
    }
   
    public GetRequest(QName qname)
    {
        if (qname == null)
            throw new NullPointerException(_MESSAGES.get("NullQName"));
       
        _qname = qname;
    }
   
    public QName getQName()
    {
        return _qname;
    }
   
    public String toString()
    {
        return XmlUtils.toString(toXML(), false);
    }
   
    public Element toXML()
    {
        return toXML(XmlUtils.EMPTY_DOC);
    }
   
    public Element toXML(Document doc)
    {
        if (doc == null)
            throw new NullPointerException(_MESSAGES.get("NullDocument"));
       
        return XmlUtils.createElement(doc, WsrpConstants.GET_QNAME, getQName());
    }
}
TOP

Related Classes of org.apache.muse.ws.resource.properties.get.impl.GetRequest

TOP
Copyright © 2018 www.massapi.com. 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.