/*
* 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.resource.metadata.ext;
import org.w3c.dom.Element;
import org.apache.muse.core.Environment;
import org.apache.muse.ws.addressing.EndpointReference;
import org.apache.muse.ws.addressing.soap.SoapClient;
import org.apache.muse.ws.addressing.soap.SoapFault;
import org.apache.muse.ws.metadata.remote.MetadataExchangeClient;
import org.apache.muse.ws.resource.metadata.MetadataDescriptor;
import org.apache.muse.ws.resource.metadata.WsrmdConstants;
import org.apache.muse.ws.resource.metadata.impl.SimpleMetadataDescriptor;
/**
*
* WsrfMetadataExchangeClient is an extension of Muse's
* {@linkplain MetadataExchangeClient MetadataExchangeClient} to include
* a convenience method for retrieving the resource's metadata descriptor.
* The getRMD() method calls getMetadata() with the WS-RMD dialect and
* returns the resulting XML as a metadata descriptor object.
*
* @author Dan Jemiolo (danj)
*
*/
public class WsrfMetadataExchangeClient extends MetadataExchangeClient
{
public WsrfMetadataExchangeClient(EndpointReference destination, EndpointReference source, Environment environment)
{
super(destination, source, environment);
}
public WsrfMetadataExchangeClient(EndpointReference destination, EndpointReference source, SoapClient soapClient)
{
super(destination, source, soapClient);
}
public WsrfMetadataExchangeClient(EndpointReference destination, EndpointReference source)
{
super(destination, source);
}
public WsrfMetadataExchangeClient(EndpointReference destination)
{
super(destination);
}
public MetadataDescriptor getRMD()
throws SoapFault
{
Element[] results = getMetadata(WsrmdConstants.NAMESPACE_URI);
if (results.length == 0)
return null;
return new SimpleMetadataDescriptor(results[0]);
}
}