package org.wsdmdemo.service.weatherStation;
import org.apache.ws.resource.ResourceContext;
import org.apache.ws.resource.properties.v2004_06.porttype.impl.SetResourcePropertiesPortTypeImpl;
import org.apache.ws.util.XmlBeanUtils;
import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument;
import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.SetResourcePropertiesDocument;
import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.SetResourcePropertiesResponseDocument;
import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.UpdateType;
/**
* **** NOTE: This file will not be overwritten during generation ****
* <p/>
* This class should be generated ONCE (and not overwritten) to maintain user-added code.
* If there is a change to the WSDL, then the generated implemented interfaces
* (representing the "base" portTypes) will change, thus showing a compile error to the
* user.
* <p/>
* NOTE: This class is generated. However, it will not be overwritten by subsequent
* calls to the code generator.
*/
public class WeatherStationService
extends AbstractWeatherStationService
implements WeatherStationCustomOperationsPortType
{
/**
* A NamespaceVerionHolder which maintains the QNames of Spec Wsdls
*/
public static final org.apache.ws.muws.v1_0.impl.WsdmNamespaceVersionHolderImpl SPEC_NAMESPACE_SET = new org.apache.ws.muws.v1_0.impl.WsdmNamespaceVersionHolderImpl();
/**
* Creates a new {@link WeatherStationService } object.
*
* @param resourceContext DOCUMENT_ME
*/
public WeatherStationService(ResourceContext resourceContext)
{
super(resourceContext);
init();
}
/**
* Returns a collection of Spec Namespaces associated with this Service
*
* @return A NamespaceVersionHolder impl which represents the collection of spec namespaces
* associated with this service.
*/
protected org.apache.ws.resource.properties.NamespaceVersionHolder getNamespaceSet()
{
return SPEC_NAMESPACE_SET;
}
public org.wsdmdemo.service.weatherStation.RecalibrateResponseDocument Recalibrate(org.wsdmdemo.service.weatherStation.RecalibrateDocument requestDoc)
{
org.wsdmdemo.service.weatherStation.RecalibrateResponseDocument responseDocument = org.wsdmdemo.service.weatherStation.RecalibrateResponseDocument.Factory.newInstance();
org.wsdmdemo.service.weatherStation.RecalibrateResponseDocument.RecalibrateResponse response = responseDocument.addNewRecalibrateResponse();
//set status to unavailable
changeOperationalStatus(OperationalStatusDocument.OperationalStatus.UNAVAILABLE);
Thread thread = new Thread(new OpStatusChanger(this));
thread.start();
return responseDocument;
}
/**
* Method to change the operational status in order to trigger a prop change event.
*
* @param status
*/
public void changeOperationalStatus(OperationalStatusDocument.OperationalStatus.Enum status)
{
SetResourcePropertiesPortTypeImpl setResourcePropertiesPortType = new SetResourcePropertiesPortTypeImpl(getResourceContext());
SetResourcePropertiesDocument setResourcePropertiesDocument = SetResourcePropertiesDocument.Factory.newInstance();
SetResourcePropertiesDocument.SetResourceProperties setResourceProperties = setResourcePropertiesDocument.addNewSetResourceProperties();
UpdateType updateType = UpdateType.Factory.newInstance();
OperationalStatusDocument operationalStatusDocument = OperationalStatusDocument.Factory.newInstance();
operationalStatusDocument.setOperationalStatus(status);
XmlBeanUtils.addChildElement(updateType, operationalStatusDocument);
setResourceProperties.setUpdateArray(new UpdateType[]{updateType});
SetResourcePropertiesResponseDocument setResourcePropertiesResponseDocument = setResourcePropertiesPortType.setResourceProperties(setResourcePropertiesDocument);
}
}