FileDocCategorySizeDatePackage
UPnPStateVariableImpl.javaAPI DocAzureus 3.0.3.43254Thu Feb 09 19:42:50 GMT 2006com.aelitis.net.upnp.impl.services

UPnPStateVariableImpl

public class UPnPStateVariableImpl extends Object implements UPnPStateVariable
author
parg

Fields Summary
protected UPnPServiceImpl
service
protected String
name
Constructors Summary
protected UPnPStateVariableImpl(UPnPServiceImpl _service, org.gudy.azureus2.plugins.utils.xml.simpleparser.SimpleXMLParserDocumentNode node)

		service	= _service;
		
		name	= node.getChild( "name" ).getValue().trim();
	
Methods Summary
public java.lang.StringgetName()

		return( name );
	
public UPnPServicegetService()

		return( service );
	
public java.lang.StringgetValue()

		try{
			String	soap_action = "urn:schemas-upnp-org:control-1-0#QueryStateVariable";
			
			String	request =
				"<?xml version=\"1.0\" encoding=\"utf-8\"?>"+
				"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"+
					"<s:Body>";
													
			request += 	"<u:QueryStateVariable xmlns:u=\"urn:schemas-upnp-org:control-1-0\">" +
							"<u:varName>" + name + "</u:varName>" +
						"</u:QueryStateVariable>";

			request += 	"</s:Body>"+
						"</s:Envelope>";
							
			SimpleXMLParserDocument resp_doc	= ((UPnPDeviceImpl)service.getDevice()).getUPnP().performSOAPRequest( service, soap_action, request );

			SimpleXMLParserDocumentNode	body = resp_doc.getChild( "Body" );
			
			SimpleXMLParserDocumentNode fault = body.getChild( "Fault" );
			
			if ( fault != null ){
				
				throw( new UPnPException( "Invoke fails - fault reported: " + fault.getValue()));
			}
			
			SimpleXMLParserDocumentNode	resp_node = body.getChild( "QueryStateVariableResponse" );
			
			if ( resp_node == null ){
				
				throw( new UPnPException( "Invoke fails - response missing: " + body.getValue()));
			}
			
			SimpleXMLParserDocumentNode	value_node = resp_node.getChild( "return" );
			
			return( value_node.getValue());
			
		}catch( Throwable e ){
			
			if ( e instanceof UPnPException ){
				
				throw((UPnPException)e);
			}
			
			throw( new UPnPException( "Invoke fails", e ));	
		}